Aerobic exercises, like swimming, are useful in pregnancy because they help build up muscle tone and stamina but they also improve your circulation, which can affect the efficiency of delivering nutrients to your growing bump. Good circulation can also improve pregnancy conditions like water retention, varicose veins and even piles (haemorrhoids).
As a non-weightbearing exercise, swimming is also a habit you can continue until late in your pregnancy. So long as you make sure the pool is not too hot or too cold, it will be a refreshing experience to get into cooling water when the increase in your blood supply makes you hot and stuffy.
Additionally, if you do other sports which make you too hot (over one degree hotter than your body would normally be) it can affect the amount of blood being used to help you cool off which would normally be going to the uterus.
There have been reports which raise concern about over-chlorinated water in swimming pools, but the risk of exposure to unneccesary chemicals is still deemed to be far smaller than the risk you pose to your body by not doing any exercise at all!
Towards the end of your pregnancy, you might feel that even swimming is taking its toll. If you have had a bloody show or seen the passage of the 'mucous plug' (which can happen just before labour or even a couple of weeks before) then speak to your midwife or GP before doing any more swimming in a public pool.
If you do any aerobic exercise when you are pregnant, do some gentle warm-down exercises afterwards to ensure an even blood flow and no dangerous 'pooling' of blood in the legs.