Swimming is a great form of exercise because it takes pressure of the spine and allows to strenghen the supporting musculature this increasig flexibility and reducing back pain. In addition, it helps to burn calories.
Intially, start by walking in the pool. When you start swimming, make sure you avoid twisting your back which could contribute to back pain.
If certain techniques cause your back pain to worsen, try to avoid those techniques.
Always check with your doctor or physical therapist before you start any exercises.