What should one do if he needs to pass gas during shomna esrei or wearing tefillin? If someone needs to pass gas is he exempt from prayer, shema, tefillin ect. Ones stomach is not always obedient to mitzvahs.
The Gemara, as ruled by the Shulchan Aruch, writes that if a person needs to pass gas, and feels that he cannot restrain himself, he should move backwards a distance of 4 amos, pass gas, and say the nusach recorded in the Shulchan Aruch (Orach Chaim 103:2).
He should then wait until the scent has passed, and then continue his prayer.
However, the Rema writes that a person should not do this in public, because of the embarrassment it will cause, and should rather just wait until the smell passes.
If a person knows in advance that he will be unable to restrain himself from passing gas during prayer, he should not pray (the Shemoneh Esrei) at all.