All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
As a basic rule, attending the Friday prayer is obligatory on whoever fulfills its due conditions, but this does not apply to someone with a foul odor; he must not go to the mosque until he removes that odor. The Prophet, sallallaahu ‘alayhi wa sallam, commanded the attendees of the Friday prayer to perform Ghusl (before going to the mosque) principally to remove such unpleasant odors. It was narrated on the authority of Ibn ‘Abbaas that he said: “I shall inform you how the practice of performing Ghusl (ritual bath) on Friday began. People were in poor and difficult circumstances. They used to wear woolen clothes and their work was to carry loads on their backs. Their mosque was rather small and had a thatched low roof. The Prophet, sallallaahu ‘alayhi wa sallam, came out one hot day when people perspired profusely in their woolen clothes, to such an extent that a foul smell emitted from them, thus harming each other thereby. When he, sallallaahu ‘alayhi wa sallam, noticed that odor, he said: ‘O people, when this day (Friday) comes, you should perform Ghusl (ritual bath) and apply the best grease and perfume you can find.’” [End of quote, Sunan Al-Bayhaqi]
A person with a foul odor should not go to the mosque before removing it, and this applies to the Friday prayer and other prayers as well. It was narrated on the authority of Jaabir ibn ‘Abdullaah that the Prophet, sallallaahu ‘alayhi wa sallam, said: “Whoever has eaten garlic or onion should keep away from us – or he said: from our mosque – and should stay at home.” [Al-Bukhari and Muslim]
Another version reads: “Whoever has eaten onion, garlic, or leek should not approach our mosque, for the angels are offended by that which offends the children of Aadam.” [Muslim]
Some jurists held that it is prohibited for a person with an unpleasant odor to enter the mosque. The Maaliki scholar Ad-Dardeer said in his book Aqrab Al-Masaalik about a person who has eaten onion or garlic or who has an unpleasant odor: “It is prohibited for a person who has eaten any of that to enter the mosque even if it is empty. He is also prohibited – and the same applies to the one suffering from foul-smelling burps because of eating radishes – from attending the gatherings of Muslims like the ‘Eid prayer, Halaqah (circles) of Thikr or knowledge, or banquets. The same ruling applies to the one who is injured and his wound emanates a foul smell or who has an unpleasant body odor.” [End of quote]
Haashiyat As-Saawi reads: “His saying, ‘It is prohibited for anyone who has eaten any of that to enter the mosque,’ means that it is forbidden as long as the odor is present and emanates from him. If he gets rid of it or it goes away on its own, then he is no longer prohibited (from entering the mosque).” [End of quote]
As long as it is prohibited for such a person to enter the mosque with that foul smell, then it is incumbent to remove it, which is neither difficult nor involves hardship.
Allah Knows best.