The Chachamim teach that one who needs to relieve himself, be it to urinate or to defecate, is prohibited from praying (Berachot 23a), since the need to relieve himself is likely to disrupt his kavanah. In addition, it is not proper to come to pray before HaKadosh Baruch Hu when one’s body is made repulsive by the excrement inside him. Even if he is uncertain as to whether or not he needs to relieve himself, it is proper that he try before beginning to pray (Berachot 15a). The Chachamim support their statement with the verse (Amos 4:12), “Israel, prepare to meet your God.” It is also written (Ecclesiastes 4:17), “Guard your foot when you go to the House of God,” meaning, make sure you do not need to relieve yourself at the time that you are standing to pray.
There are two levels of need: 1) a need so pressing that it is impossible to wait even the amount of time it takes to walk a parsah, which is approximately 72 minutes; 2) a need to relieve oneself, but which can be controlled for longer than 72 minutes.
If a person begins to recite the Amidah when he cannot control his need to defecate for 72 minutes, his prayer is considered an abomination and he does not fulfill his obligation. Instead, he must go back and repeat his prayer after he relieves himself. However, if he recites the Amidah when he cannot control his need to urinate for 72 minutes, although it is clear that he did not act in accordance with the law, the Acharonim are divided as to whether or not his prayer is considered an abomination. Due to the fact that it is not in our power to settle this dispute, there is no obligation to repeat the prayer, but it is good to go back and pray a voluntary prayer (tefillat nedavah) (see Bei’ur Halachah 92:1, s.v. “V’tzarich lachzor”).
If a person is able to control himself for 72 minutes, and he recites the Amidah, his prayer is considered valid because his need to relieve himself is not so urgent. In any case, l’chatchilah, even a person who can wait 72 minutes is prohibited from praying. Even if he will miss praying in a minyan because of this, he must relieve himself and pray individually. If, however, before he relieves himself, the time to pray will pass, he should pray immediately so that he will not miss praying altogether (Shulchan Aruch 92:1; Mishnah Berurah 92:5).
The estimation of a person’s ability to control himself can only be determined by the person himself. If he thought before the prayer service that he could wait 72 minutes, but after beginning to pray he was proven mistaken, his prayer is still considered valid, since at the time he started to pray he believed he could contain his need (Bei’ur Halachah 92:1, s.v. “Shiur Parsah”).
If he has doubt as to whether or not he needs to relieve himself, or if his need is very slight, as we learned, l’chatchilah he should relieve himself before the prayer service, but he should not miss out on praying with a minyan for that purpose.
.According to the Magen Avraham, it is not necessary to go back and repeat the prayer. However, according to the Eliyah Rabbah, one must. Many Acharonim are lenient like the Magen Avraham, such as the Shulchan Aruch HaRav 92:1 and the Aruch HaShulchan 92:1. The Kaf HaChaim 92:4 is inclined to rule this way as well. Nevertheless, the Bei’ur Halachah writes that we do not have the power to resolve this disagreement. The subsequent conclusion is that it is good to recite a voluntary prayer (tefillat nedavah).As for the reason behind this controversy, there are those who maintain that it is contingent upon the root of the prohibition. According to the Rambam, Hilchot Tefillah 4:1, it is because the need to relieve oneself disturbs one’s kavanah. If so, no distinction is made between urine and excrement and his prayer is considered an abomination. According to Rabbeinu Simchah, who is cited by the Hagahot Maymoniyot, it is because his body is in a state of repugnancy. Therefore, the prayer of a person who only needs to urinate is not considered an abomination, since urine does not have as much contamination. Likewise, the prohibition to distance oneself from urine is rabbinic, and from excrement, biblical, as written in Or L’Tzion, part 2, chapter 7, 15. Or L’Tzion links this dispute to the argument regarding whether or not one who needs to relieve himself is prohibited from learning Torah and reciting Shema. If it is because the need is a disturbance, he is only prohibited from praying the Amidah. However, if it is because his body is considered an abomination, the prohibition applies to all matters of sanctity. (Nevertheless, an argument can be made that one fulfills his obligation b’dieved if he recites matters of sanctity when he cannot control himself for 72 minutes, even according to the opinion that his body is an abomination, because he is not considered one who is standing before the King, as is explained later on.) In practice, we are careful to follow both interpretations.