Hadith 1704 It has been narrated that `Umar
said in the sermon of Friday prayer: "O you people! You eat garlic and onion. I think the odour of these to be very offensive. I saw that if the Messenger of Allah
happened to find a man with such offensive odour in the Masjid, he would order him to be taken out of the Masjid and sent to Al-Baqi`. He who wants to eat any of these, should cook them till their odour dies out. [Muslim].
Commentary: 1. Khabith generally means impure, base and wicked, but it is also used in the sense of Haram (unlawful), that is for eatables which are forbidden or which have an unpleasant and disgusting smell. Garlic, onion etc., are Khabith in their raw form and Muslims have been prohibited from going to the Masjid after eating them.
One can, however, eat them in their cooked form. One can also use them when the time to go to Masjid for Salat is not very near. We also learn from this Hadith that one should not eat any such odorous thing when he has to go to the Masjid or Madrasah or any congregation for some religious purpose because it will be repulsive for the people present there. Their eating is, however, permissible even in their raw form, if one is not going to the Masjid for Salat.
2. We also learn from this Hadith that Masjids should be kept free from every kind of filth and odorous things. There is no justification for the construction of toilets in the premises of Masjid. Masjids which have toilets within their compounds must be divested of the toilets to purge them of the unclean environments.