Nothing sets you further back in your exercise and fitness goals than having to stop a favorite activity due to injury. A sprained ankle prevents you from many activities, but it doesn't have to stop you from swimming. With precautions, you can still swim even if you have sprained ankle.
Ankle sprains vary in severity, so follow your doctor's advice about returning to any level of activity. In general, you should spend the first week letting the injury heal and the next few weeks returning to limited activity focused on strengthening the ankle, according to the American Academy of Orthopaedic Surgeons. However, severe ankle sprains may require more time and specific physical therapy before you're allowed to try a swim.
If your ankle is still significantly swollen, it's not ready for any activity. You can swim recreationally, but not for a workout. If your ankle is recovering and your doctor allows minimal activity, use a pull buoy to support your legs and use your arms for your workout. To use a pull buoy, hold the float between your legs, either near your pelvis or knees, depending on what's comfortable, and use the freestyle stroke to power your swim. Once you're comfortable with the pull buoy, try swimming backstroke to avoid boredom.
What to Avoid
Avoid a kick workout as a freestyle kicking motion and a breaststroke kicking motion require flexion of the foot that may trigger ankle pain. Similarly, the dolphin kick requires a pointed toe, so it may make your ankle hurt. Use the time in the water to perfect your arm stroke and your breathing pattern for both freestyle and the backstroke. In addition, avoid diving as pushing off the platform or deck requires your ankle to bend significantly and may trigger pain.
Don't ignore pain in your ankle. If you feel discomfort, stop and get out of the pool. Ankle sprains can become chronic if they aren't allowed to heal properly when they first occur. Don't push yourself -- the buoyancy you feel in the water is deceptive. It still requires force to move through the resistance of the water. If your ankle isn't ready, you can do more damage than good.