Resisting the urgent need to urinate or defecate (Mudafa'at al-Akhbatha-yn) is a valid excuse to miss the congregation, and performing prayer in this state is legally disliked (Makruh).

Excuses for Missing Congregational Prayer and Follower Postures