When the Prophet (peace be upon him) was preaching his message in Makkah, those who responded to his call were subjected to much pressure by the unbelievers. Fearing that greater trouble would erupt between the two camps, and keen to demonstrate that the message of Islam was universal, addressed to all mankind, the Prophet advised his companions to immigrate to Abyssinia. A total of 101 of them did so. They returned in batches over a number of years. Two of the women who immigrated, Umm Salamah and Umm Habeebah, lost their husbands in different circumstances. The Prophet married both of them, Umm Salamah in Madinah and Umm Habeebah when she was still in Abyssinia, a couple of years before her return.
When the Prophet suffered his last illness, he was nursed in Ayesha’s home. These two of his wives remembered something they saw in Abyssinia and brought it to the Prophet’s attention so that he could give a ruling over the matter. Ayesha reports: “Umm Habeebah and Umm Salamah mentioned to the Prophet that they saw a church in Abyssinia where there were several statues. He said: ‘It was the practice in that community that when a devout person died, they would build a place of worship over his grave and place such statues within it. Such people are the worst in God’s sight on the Day of Judgment.’” (Related by Al-Bukhari).
There are two aspects to the practice the Prophet condemns in very clear terms: Building places of worship over graves and placing statues in them. The second is far more serious than the first. What happened in the cases of different religions was that people made statues of their most devout people. They would first look at these statues and reminisce over the virtues of the deceased person, elevating him to a position of sainthood. After a few generations, the statue becomes a symbol at which worship is offered. Then it becomes a focus of worship, and the person it represents is given a godly status. This is the aspect the Prophet warns against in very clear terms, saying that the people who make such statues and put them in places of worship are the worst in God’s sight. They deserve this low position because they start the action that leads to offering worship to statues instead of offering it to God Almighty.
The other aspect is burying devout people in mosques or places of worship. Again the Prophet makes clear that this is totally unacceptable in Islam. Whether a mosque is already built and a dead body is brought to be buried in it, or a mosque is built over the grave of a person, the practice is forbidden in Islam. It does not matter where in the mosque the grave is placed. Even if it is in the rear and the worshippers would stand in front of it when they pray, the same ruling of prohibition applies. Needless to say that if it is in the front and the worshippers face the grave during their prayer, the offence is greater and more serious. No mosque should include a grave within it, even though it is to the side. A mosque that includes such a grave should be destroyed. Prayer there is not valid.