Most back pain is caused by overly tight muscles or poor alignment while lifting objects. That is why your first line of defense is always going to be good posture. Your shoulders should line up over your hips and there should be a natural curve in your spine. This is important even when you are sitting down. Make sure you are not leaning forward and try to avoid crossing your legs or ankles.
Stretching is the next thing you can do to prevent back pain. You will want to stretch your back, gluteal, hip flexor, and hamstring muscles. These tend to get very tight and short when you sit for a long time each day. When they are tight they pull your back out of alignment which can lead to pain and injury.
Finally, strengthening will go a long way to avoid back pain. Strong muscles work better and are able to carry heavier loads. They also help with your balance and prevent slip-ups and falls that can do damage. Remember, a strong back is a healthy back!