On the authority of ʿĀʾishah (may Allah be pleased with her) and ʿAbd Allāh ibn ʿAbbās who both said (1):
“When death approached the Messenger of Allah (may Allah bless him and grant him peace), he kept drawing a small cloak over his face; when it caused him distress he would remove it, and while in that condition he declared, ‘May Allah curse the Jews and the Christians; they turned the graves of their prophets into places of worship,’ warning against what they had done.” Reported by al-Bukhārī and Muslim (2).
Al-Bukhārī and Muslim also relate from Abū Hurayrah that the Messenger of Allah (may Allah bless him and grant him peace) said: “May Allah fight the Jews (3); they made the graves of their prophets into mosques” (4). In another narration recorded by Muslim: “May Allah curse the Jews and the Christians; they turned the graves of their prophets into mosques” (5).
Thus he forbade taking graves as places of worship at the very end of his life, and while in the throes of death he cursed those among the People of the Book who had done so, in order to warn his Ummah against following their example.
ʿĀʾishah said: During the illness from which he never recovered, the Messenger of Allah (may Allah bless him and grant him peace) said, “May Allah curse the Jews and the Christians; they took the graves of their prophets as mosques.” Had it not been for this warning, his grave would have been made prominent, but he feared it might be taken as a mosque. Reported by al-Bukhārī and Muslim (6).