This excerpt is taken from Sheikh al-Islam Imam Ibn Taymiyyah's book Al-Jawab al-Bahir fi Zuwar al-Maqabir, translated by Sheikh Ataullah Saqib.
Allah's Curse on Grave Worshippers
Sayyida Aisha (may Allah be pleased with her) says that the Messenger of Allah (peace be upon him) said during his illness:
لعن الله اليهود والنصارى اتخذوا قبور أنبيائهم مساجد يحذر ما صنعوا
"Allah Almighty cursed the Jews and Christians because they made the graves of their prophets places of worship. The Messenger of Allah (peace be upon him) feared this evil practice of theirs."
Reference: (Sahih Bukhari, Book of Funerals, Chapter: What is disliked about making mosques on graves, Hadith: 1330, Sahih Muslim, Book of Mosques, Chapter: Prohibition of building mosques on graves, Hadith: 529)
The Wisdom of the Grave in the Blessed Chamber:
She (may Allah be pleased with her) further says:
ولولا ذلك لأبرز قبره ولكن كره أن يتخذ مسجدا
"If there was no fear, your grave would have been made apparent, but you did not like that your grave should become a place of worship."
Reference: (Sahih Bukhari and Sahih Muslim (previous reference)
Prohibition of Worship Near Graves:
According to a narration in Sahih Muslim, the Messenger of Allah, peace be upon him, said five days before his death:
إن من كان قبلكم كانوا يتخذون قبور أنبيائهم وصالحيهم مساجد ألا فلا تتخذوا القبور مساجد إني أنهاكم عن ذلك
"People before you used to make the graves of prophets and righteous people places of worship. Beware! Do not make graves into mosques; I forbid you from doing so."
Reference: Sahih Muslim, Book of Mosques, Chapter on Prohibition of Building Mosques on Graves (Hadith: 532)
The following words are also narrated in Sahih Muslim:
لا تجلسوا على القبور ولا تصلوا إليها
"Neither sit as a neighbor by the grave nor pray facing the grave."
Reference: Sahih Muslim, Book of Funerals, Chapter on Prohibition of Sitting on Graves and Praying Towards Them (Hadith: 972)
The History of Grave Worship and Shirk:
From these narrations, it is understood that making graves places of worship and praying facing them is prohibited, and the Jews and Christians were cursed because they made the graves of their prophets places of worship. For this reason, the plague of polytheism spread among the people of Noah. Allah Almighty says about the people of Noah:
وَدًّا وَلَا سُوَاعًا وَلَا يَغُوثَ وَيَعُوقَ وَنَسْرًا ﴿٢٣﴾ وَقَدْ أَضَلُّوا كَثِيرًا
"They said, 'Never abandon your gods, nor abandon Wadd and Suwa', nor Yaghuth and Ya'uq and Nasr,' and they misled many people."
Reference: (71-Nuh:23-24)
Among the pious predecessors of the Ummah, Sayyiduna Ibn Abbas (may Allah be pleased with him and his father) and some other senior scholars have said: "Wadd, Suwa', Yaghuth, Ya'uq, and Nasr, etc., were righteous and pious individuals among the people of Noah. When they passed away, people began to sit near their graves as devotees, then after some time, they made images of them, and after some time passed, they started worshipping them."
Reference: Sahih Bukhari, Book of Tafsir: Surah Nuh (Hadith: 4920)