I was lucky enough to go to a primary school where the former headmistress' husband was a builder. In the late 80s, he installed a swimming pool on the school grounds, and a few years later (soon after I started in '94), he returned to build a glass roof over the top. It was like swimming in a gigantic greenhouse! Not so bad when it was cloudy, but when it was really sunny (that one week a year), it was unbearably hot.
So, we all had swimming lessons, from the age of 4/5 to 11. It was a very small school - only about 100 students in total, split into 1 class per year, so there was plenty of room for a class to learn together.
I went to a private secondary school, and we did have an indoor swimming pool. However, swimming was totally optional. I did choose it every summer (over rounders or tennis), but no one was forced to swim. I also did lifeguard training, which was available to anyone in y10 and above (age 15 and up).
However, my experiences are not "typical" of a UK school.