Question: I am writing this letter to inquire about offering Salaah (prayer) in a Masjid (mosque) with a grave inside it. Some scholars say that it is impermissible to pray there and if there is no other Masjid in town, it is better to pray at home than in a Masjid with a grave inside it. Other scholars say that it is permissible to pray there, because the grave of the Messenger of Allaah (peace be upon him) is inside his Masjid, as well as the graves of his two Companions, Aboo Bakr and ‘Umar. This matter seems confusing to me, so I wrote this letter to inquire about the truth. I live in the countryside of Senegal where there is only one Masjid in our town in which there are four graves. Three of them are outside the Masjid, but they are adjacent to its southern part, whereas the fourth is completely inside the Masjid. Please inform me of the truth supported by evidence, as I know nothing about this matter, therefore I am asking you, for Allaah says in His Glorious Book (what means): So ask the people of the Scripture, if you do not know. (Soorah Al-Nahl, 16: 43).
Answer: First, it is impermissible to build Masjids over graves, or offer Salaah in a Masjid that was built over a grave or graves, as it is authentically established that `Aa’ishah (may Allaah be pleased with her) said… read more here.