No problem: The idea is that most people who pee in a body of water do it while in the water. The joke is set up as though you'd expect me to have swum down to the deep end and peed while still immersed in the water.
However, the punchline lets you know that I (fictionally, of course) was standing on the side of the pool and peeing into the pool in full view.
The only reason the lifeguard could catch me was because I was above water. The joke is set up so you think I was in the water.
And to reiterate, this is purely a fictional joke!