Also in the two Sahīh collections, ‘Ā’isha and Ibn ‘Abbās narrated:
“When Allah’s Messenger, may Allah bless him and grant him peace, was in the throes of death, he began placing a cloak over his face. Whenever it made breathing difficult, he would uncover his face. While in that state, he said: ‘May Allah curse the Jews and Christians: they took the graves of their prophets as places of worship.’”
He was warning against what they had done.
Also in the two Sahīh collections, ‘Ā’isha said:
“During the illness from which he never recovered, Allah’s Messenger, may Allah bless him and grant him peace, said: ‘May Allah curse the Jews and Christians: they took the graves of their prophets as places of worship.’ Were it not for that, his grave would have been left exposed, but he feared that it might be taken as a place of worship.”
In Sahīh Muslim, Jundub ibn ‘Abd Allāh said:
“I heard Allah’s Messenger, may Allah bless him and grant him peace, say five days before his death: ‘I declare before Allah that I take none of you as an intimate friend, for Allah has taken me as an intimate friend just as He took Abraham as an intimate friend. Were I to take anyone from my community as an intimate friend, I would take Abū Bakr. Indeed, those before you took the graves of their prophets as places of worship. So do not take graves as places of worship, for I forbid you to do so.’”
In Sahīh Muslim, Abū Marthad al-Ghanawī narrated that Allah’s Messenger, may Allah bless him and grant him peace, said:
“Do not sit on graves or pray towards them.”
Abū Sa‘īd al-Khudrī, may Allah be pleased with him, narrated that Allah’s Messenger, may Allah bless him and grant him peace, said:
“The entire earth is a place of prayer except graveyards and bathhouses.”
This was reported by the compilers of the Sunan collections;