Let's look at the facts. When you sit for long periods of time your gluteals (rear end muscles) become weak because they're not being used. Meanwhile your hip flexor muscles (in the front where your leg meets your hip) get overly tight because they are kept in a shortened position for too long. Both of these translate into back pain.
As we move up the body we often find that people do not sit with good posture. Instead they hunch over their computer which tightens the chest muscles and curves the shoulders. It also pushes the neck forward which can lead to headaches. Finally, if the arm is not fully resting on the desk surface it can cause pain in the forearm and wrists.
Fortunately, there are things you can do to fight these issues. Your first line of defense is to sit at your desk with good posture. Move your computer closer and make sure you are sitting so the screen is at eye level. Consciously work to keep your shoulders and neck pulled back. Also try to keep both feet flat on the ground. instead of crossing your legs or ankles.
Next, be sure to get up and move around every single hour. If you have to set a timer on your computer to remind yourself to move, then do it. I like to get up and refill my water bottle which has the added benefit of keeping me hydrated. While you're up, do some light body movements such as swinging your arms and gently twisting from side-to-side. This will get your blood circulating. You can even take some deep breaths, which has a relaxing effect on the mind and body.
At least once a day it's also a good idea to do some stretching. You'll want to warm up beforehand so do the stretches after you have taken one of your hourly strolls. The following moves will target each area of your body that may have issues. Aim to hold the stretch for at least 30 seconds and be sure you're breathing throughout.
Hip Flexor Stretch (as seen in the photo below)
Stand next to a sturdy chair. Hold onto it with your right hand and step the left leg back about 2 feet. Then bend both knees and lower down until you feel a stretch in the left hip flexor. Repeat on the other side.
Stand with good posture and your feet directly below your hips. Keep your arms straight down at your sides and then slowly bring them behind your body. Try to clasp your hands behind your back if you can. If not, just keep them behind your body and feel the stretch in your chest.
Stand with good posture and your feet directly below your hips. Bring your right arm out in front of you so that it is level with your shoulder, palm facing up. Reach up with your left hand, grasp your right fingers and pull them down so that they point towards the floor. Keep your right arm still at shoulder level. Repeat on the other side.
Sit in a sturdy chair with both feet flat on the floor. Bring your right ankle up and rest it on your left thigh. Lean forward until you feel a stretch in your rear.
Sit in a sturdy chair and keep your feet flat on the floor. Twist your upper torso to the right while keeping your lower body straight. Hold. Then twist to the left.
Sit in a sturdy chair and keep your feet flat on the floor. Tilt your head down and to the right as if you are trying to touch your right ear to your right shoulder. Hold. Then tilt your head down to the left.