Avoid doing anything that makes the pain worse or carries the risk of re-injuring your back. What exercises are safe to do depends on the activity and on what exactly is wrong with your back. Your best bet is to start slowly and gradually begin doing your usual activities. If you normally do intense exercise or sports that involve twisting your back, like golf, you need to wait until your back is better. Walking and swimming are probably the best exercises for rehabilitating your back. They keep you from putting too much stress on your body, yet they get your entire body moving.
Talk with your doctor and physical therapist about how to get started on a program of exercise to help you get back to full function.