Even after you have peed, the moment you go underwater, pressure built-up will compress your body and you will start producing urine. You can choose to hold it (which is bad), or to let it go.
As you go deeper, the temperature changes and it gets colder. This causes your blood vessels to constrict. Your body will then be sending a large volume of blood into your lungs and heart, and large blood vessels. This increase is then intepreted by your body as an overload and you will automatically produce urine to overcome this overload. If you hold it until the end of the dive, then as the pressure decreases and temperature increases, your blood volume will return to almost normal, but your bladder would be full. That's probably one of the reasons you see some divers jump back into the water to pee after taking off their equipment.
Unless you suck things up from your gunner like a straw, urinating underwater should pose no problems. I still whack at an average of 4 times a day and have been diving since 1982. Uncle Henry of Scuba Dynamics have been diving for much longer and have contributed to the hypersalination of the local waters, yet he got married recently, proving that his gunner can still deliver effective fire missions. But if you hold back your urine for too long, this can potentially cause your ureters to enlarge, and if you do it too often, damage your ureters and cause bacteria to go back to your kidneys and you may get what is known as uremic poisoning if not treated. Some say it can also cause prostate cancer, unless you're a woman.