Wearable exoskeletons can help people with mobility impairments by improving their rehabilitation. As electromyography (EMG) signals occur before movement, they can be used as input signals for the exoskeletons to predict the body’s movement intention. In this paper, the OpenSim software is used to determine the muscle sites to be measured, i.e., rectus femoris, vastus lateralis, semitendinosus, biceps femoris, lateral gastrocnemius, and tibial anterior. The surface electromyography (sEMG) signals and inertial data are collected from the lower limbs while the human body is walking, going upstairs, and going uphill. The sEMG noise is reduced by a wavelet-threshold-based complete ensemble empirical mode decomposition with adaptive noise (CEEMDAN) reduction algorithm, and the time-domain features are extracted from the noise-reduced sEMG signals. Knee and hip angles during motion are calculated using quaternions through coordinate transformations. The random forest (RF) regression algorithm optimized by cuckoo search (CS), shortened as CS-RF, is used to establish the prediction model of lower limb joint angles by sEMG signals. Finally, root mean square error (RMSE), mean absolute error (MAE), and coefficient of determination (R2) are used as evaluation metrics to compare the prediction performance of the RF, support vector machine (SVM), back propagation (BP) neural network, and CS-RF. The evaluation results of CS-RF are superior to other algorithms under the three motion scenarios, with optimal metric values of 1.9167, 1.3893, and 0.9815, respectively.