Praise be to Allah.
If a person has the problem of offensive body odour, and he cannot conceal it by using perfume and the like, then he is excused for not praying in congregation and there is the hope that he will be rewarded by Allah. If bathing will remove this smell, then he should do it as much as he can. Allah has made the means that help with that readily available, such as hot water and the ability to protect oneself against cold by wearing warm clothes, and the like.
The fuqaha’ have stated that the presence of an offensive smell is an excuse for not praying in congregation. In fact they tell the one who has a smell not to enter the mosque and annoy the worshippers.
The basic principle with regard to that is the report narrated by Muslim (564) from Jaabir ibn ‘Abd-Allaah (may Allah be pleased with him) from the Prophet (blessings and peace of Allah be upon him) who said: “whoever eats garlic, onions or leeks, let him not come near our mosque, for the angels are offended by the same things that offend the sons of Adam.”
It says in Mataalib Ooli al-Nuha (1/699): It is makrooh to attend the mosque and prayer in congregation for the one who eats garlic, onions, or leeks, and anything that has an offensive smell, until that smell has gone. The same applies to one who has bad breath or body odour from the armpits or anything that has a rotten smell. It is mustahabb to make them leave, so as to ward off annoyance.
It says in Asna al-Mataalib (1/215): From what is mentioned, it may be understood that if the person who has a chronic and serious problem with bad breath and body odour, it is more appropriate for him to be excused from coming to the mosque to pray in congregation. End quote.
Shaykh Ibn Baaz (may Allah have mercy on him) was asked: My father is elderly and does not go to pray in congregation, and he says that he is ill with something that causes bad breath and an unpleasant smell, and he says that he does not want to annoy the people with this smell. Is it permissible for him to do this?
He replied: Yes, this is a legitimate excuse. If he has severe halitosis that smells bad and he cannot remove it, then he is excused. Similarly, onions or leeks are an excuse. But if there is any remedy or a way to remove the smell, then he must do that, so that he will not stay away from Jumu’ah prayer and prayers in congregation. But if he is unable to do that and it is not easy for him, then his excuse is stronger than the excuse of the one who eats onions. Undoubtedly bad breath is annoying to the people around him, if the smell is obvious. End quote from Noor ‘ala al-Darb (tape no. 219, minute 11).
We ask Allah to heal you and give you good health.
And Allah knows best.