Slightly longer answer: ALL THE TIME!
More details from Olympic swimmer Carly Geehr:
You always try to pee before you swim, but sometimes your body defies logic and finds a way to refill your bladder just to spite you. Adrenaline and nerves wreak havoc on your system, and I knew tons of other swimmers that always, regardless of prior planning, had to pee right before a race. So it's not uncommon to splash yourself before you climb up on the blocks, so that extra liquid on yourself and the pool deck affords you an interesting opportunity. (I'll let you finish the rest of that thought.)
As a swimmer, you just have to accept that you're swimming in pee. I had a teammate that would sit on the wall and announce “I'm peeing!” which was ... disgusting ... but at least she warned us. I'm sure I've swum directly behind people who were just letting it all out.
The only way you can really tell if someone's peeing in the pool is if they announce it to you or they're really dehydrated/sitting in one spot while they go. It diffuses pretty quickly, and if you're moving, it diffuses even faster.