When you take a poo you relax the same muscles that you do when you pee. Therefore you pee. It works the other way too, i.e. farting while you pee..not un common. I had a doctor use more terms when he explained it to me, but you get the jist