ENOfficial
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).
Source: sunnah.com
Other translations
Arabic
حَدَّثَنَا بِشْرُ بْنُ آدَمَ، حَدَّثَنَا زَيْدُ بْنُ الْحُبَابِ، حَدَّثَنَا مُعَاوِيَةُ بْنُ صَالِحٍ، عَنِ السَّفْرِ بْنِ نُسَيْرٍ، عَنْ يَزِيدَ بْنِ شُرَيْحٍ، عَنْ أَبِي أُمَامَةَ، أَنَّ رَسُولَ اللَّهِ ـ صلى الله عليه وسلم ـ نَهَى أَنْ يُصَلِّيَ الرَّجُلُ وَهُوَ حَاقِنٌ .
sunnah.com