The cause of back pain is multifactorial. Contributing factors include moving improperly (i.e., twisting the torso while lifting), weak muscles (e.g., abdominals, lower back, gluteals, etc.), tight muscles (e.g., hamstrings, hip flexors, etc.), and/or sitting for too long with improper posture (i.e., slouching at the desk hunched over a computer). Most people would prefer to be sedentary when experiencing pain but this is the worst thing you can do. Your muscles will become weaker from disuse. Remember that exercise serves to strengthen and stretch muscles as well as lessen postural imbalances.
So what exercises should you do if you feel back pain? Aerobic exercise (e.g., walking, swimming, cycling, etc.) as well as anaerobic exercise involving the core muscles (e.g., crunches, pelvic tilts, back bridges, planks, back extension, etc.). Avoid any ballistic movement (i.e., jump rope, box jumping, running, etc.) or any movement that increases back strain or stress.
Brian Danley, CFT
"Motivation is what gets you started. Habit is what keeps you going."