Question: What is the ruling on offering Salaah (Prayer) in Masjids (mosques) that contain graves and shrines?
Answer: It is not permissible for a Muslim to offer Salaah in Masjids built over graves. This ruling is based on pieces of evidence prohibiting the building of places of worship over graves. Among such pieces of evidence is the Hadeeth reported in the Two Saheeh (authentic) Books of Hadeeth (i.e. Al-Bukhaaree and Muslim) on the authority of `Aa’ishah (may Allaah be pleased with her) who narrated that Umm Salamah once told the Messenger of Allaah (peace be upon him) about a church that she saw in Abyssinia (Ethiopia) and the pictures that were in it… read more here.