Ruling on prayer in congregation for one who is sick and one who cannot control najaasah (impurity)
Question

 
I have a colleague who had an operation to remove the opening of the anus and create an opening in his side because of a tumour.
 My question is: with the new opening he cannot control what comes out or the smell. Is it permissible for him to pray in the mosque or should he pray at home?.
Praise be to Allah.Firstly: 
We ask Allah to heal him and make him well, and we ask Him to bless him with patience and reward him for the trials he is going through. 
With this sickness, the patient cannot control emission of stools, rather the stools come out continually through the opening that has been created in his side. So the ruling in this case is the same as the ruling on continual incontinence. 
Based on this, it is permissible for a person who has this problem to combine two prayers if it is difficult for him to offer each prayer at its proper time. Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said:  
The correct view is that joining prayers is not something that is only for lengthy journeys, rather prayers may be joined because of rain or because of sickness, as is narrated in the Sunnah concerning a woman who was suffering from istihaadah (irregular non-menstrual vaginal bleeding), and the Prophet (peace and blessings of Allah be upon him) told her to combine two prayers, as was mentioned in two hadeeths.(Al-Fatawa al-Kubra, 1/49)
The scholars of the Standing Committee said concerning the ruling on a woman who cannot control her urine because of some sickness that she is suffering from: 
If the matter is as described, then she should pray according to her situation, and there is no reason why she should not combine Zuhr and ‘Asr at the time of one of them, and Maghrib and ‘Isha’, because of the general meaning of the evidence that indicates that Islam seeks to make things easy. This is subject to the condition that her wudoo’ for Zuhr and ‘Asr be done after the time for them begins, and likewise that her wudoo’ for Maghrib and ‘Isha’ be done after the time for them begins. 
Fatawa al-Lajnah al-Daa’imah li’l-Buhooth al-‘Ilmiyyah wa’l-Ifta, 8/85 
Secondly: 
The obligation to pray in congregation in the mosque is not waived in such cases, unless by going there the patient is likely to contaminate the mosque or there will be an offensive smell from the new opening, because that will bother the other worshippers. 
With regard to the unpleasant smell, if there is such a smell emanating from a person, this excuses him from having to attend prayers in congregation, indeed it is not permissible for him to come to the mosque and annoy the angels and worshippers with this smell. 
Shaykh Muhammad ibn Saalih al-‘Uthaymeen said: 
If there is an offensive smell coming from his mouth, nose or elsewhere that offends the worshippers, then he should not attend, so as to ward off that annoyance. 
Al-Sharh al-Mumti’, 4/323 
The one who has eaten onions and garlic is forbidden to attend congregational prayer in the mosque, because these two vegetables have unpleasant smells. We may add to that the foul smell of tobacco and cigarettes, which are haraam. 
Muslim (564) narrated from Jaabir ibn ‘Abd-Allah that the Prophet (peace and blessings of Allah be upon him) said: “Whoever has eaten onions, garlic or leeks, let him not come near our mosque, for the angels are offended by that which offends the sons of Adam.” 
If it was this patient’s habit to pray in congregation in the mosque, then the reward for that will be recorded for him even if he prays in his house. 
Shaykh Ibn ‘Uthaymeen said: 
The person who is excused will have the reward of praying in congregation recorded for him in full, if it was his habit to pray in congregation, because the Prophet (peace and blessings of Allah be upon him) said: “If a person falls sick or travels, the reward for what he used to do when he was healthy and not travelling will be recorded for him.” 
Al-Sharh al-Mumti’, 4/323 
With regard to contaminating the mosque with impure things, this is haraam. We have been commanded to clean and perfume the mosques. 
Al-Bukhaari (221) and Muslim (284) narrated that Anas ibn Maalik said: A Bedouin came and urinated in a corner of the mosque and the people rebuked him. The Prophet (peace and blessings of Allah be upon him) told them not to do that. When he had finished urinating, the Prophet (peace and blessings of Allah be upon him) called for a bucket of water and poured it over it. 
According to a version narrated by Muslim (285): Then the Messenger of Allah (peace and blessings of Allah be upon him) called him and said to him: These mosques are not places for urinating or any other filthy thing, rather they are for the remembrance of Allah, may He be glorified, prayer and reading Qur’aan.” 
Al-Nawawi said in Sharh Saheeh Muslim: 
It is haraam to bring najaasah (impurities) into the mosque. If a person on whose body is something impure fears that it may contaminate the mosque, it is not permissible for him to enter. If there is no such danger then it is permissible (for him to enter).