It was narrated from Abu Umamah that:
The Messenger of Allah forbade a man to perform prayer when he was suppressing (the urge to urinate or defecate).
English reference: Vol. 1, Book 1, Hadith 617
Arabic reference: Book 1, Hadith 660
Read hadith from the major collections in the app, with prayer times and a Qibla compass. Free.