Unlike exercise machines in a gym that tend to isolate one body part at a time (like a bicep curl machine, for example), swimming puts the body through a broad range of motion that helps joints and ligaments stay loose and flexible. The arms move in wide arcs, the hips are engaged as the legs scissor through the water, and the head and spine twist from side to side. Plus, with every stroke, as you reach forward, you're lengthening the body, which not only makes it more efficient in the water, it also helps give you a good stretch from head to toe.
To improve your flexibility beyond the natural gains you'll make by swimming, you might also want to finish your pool workout with a series of gentle stretches. The support of the water should help you maintain positions involving tricky balance -- such as a quadriceps stretch -- for longer periods of time.