The other day I was in the Masjid praying next to a man who smelled very bad. I was so disturbed by his odor that I lost focus in my prayer; I was literally turning my face the other way so I won't smell this uncomfortable odor. Is a permissible in such cases to exit the prayer and move to a different place?
All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
It is not permissible for whoever has started performing an obligatory prayer by saying 'Allaahu Akbar' to interrupt his prayer just because of the presence of someone next to him from whom an unpleasant smell comes, like the smell of garlic, onions and the like. Rather, he is obliged to continue his prayer until he finishes while trying to achieve submissiveness and tranquillity in prayer as much as he can. After finishing the prayer, he may then advise that person and admonish him not to harm people and angels with his unpleasant smell.
Allaah Knows best.
You can search for fatwa through many choices