Praying while needing to pass wind
Question
What is the ruling regarding an ailment of wind (rih)? It is said that holding back overpowering wind during the prayer is makruh tahrimi.
Answer
When there is an urge to relieve oneself, to urinate or to pass wind, and one’s mind is disturbed, praying in such a state is forbidden: one should first be free of these things and then pray with composure. If, however, a person is ma‘dhur (excused) — he has an ailment of wind and does not get enough time to make wudu and pray without passing wind — then he is an exception.
Source: Fatawa Mahmudiyya
Preview. The full text opens with JavaScript enabled.