Exception (Hadith No. 224)
Once the Prophet went to the dumps of some people and passed urine while standing. He then asked for water and so I brought it to him and he performed ablution.
Urinating while standing is prohibited in Islam. But here the Prophet (SAW) does otherwise. Reason: the place was filthy. Sitting on dumps might have caused him to catch a lot of germs. It was unhealthy and dangerous. This is called an exception: Based on an external factor in your situation, you do contrary to the rule.
It is not haraam for a man to urinate standing up, but it is Sunnah for him to urinate sitting down, because ‘Aa’ishah (may Allaah be pleased with her) said: “Whoever tells you that the Prophet (peace and blessings of Allaah be upon him) used to urinate standing up, do not believe him. He only ever used to urinate sitting down.” (Narrated by al-Tirmidhi, al-Tahaarah, 12; he said, this is the most saheeh report on this topic. It was also classed as saheeh by al-Albaani in Saheeh Sunan al-Tirmidhi, no. 11). And because this is more concealing, and it reduces the risk of any drops of urine splashing up onto him.
It was narrated from ‘Umar, Ibn ‘Umar and Zayd ibn Thaabit (may Allaah be pleased with them) that it is allowed to urinate standing up on the condition that there is no risk of drops of urine splashing onto one’s body or clothes, and that one does not expose one’s ‘awrah, because al-Bukhaari and Muslim narrated from Hudhayfah (may Allaah be pleased with him) that the Prophet (peace and blessings of Allaah be upon him) came to a garden belonging to some people, and urinated standing up. There is no contradiction between this and the hadeeth of ‘Aa’ishah (may Allaah be pleased with her), because it is possible that the Prophet (peace and blessings of Allaah be upon him) did that because he was in a place where he was unable to sit down, or he did that to show the people that it is not haraam. This does not contradict the basic principle mentioned by ‘Aa’ishah (may Allaah be pleased with her), that he (peace and blessings of Allaah be upon him) urinated sitting down, because it is Sunnah, it is not something waajib (obligatory) which it is forbidden to go against. And Allaah knows best.
Taken from IslamQA