Sayyiduna Abu Marthad al-Ghanawi (may Allah be pleased with him) said: I heard the Prophet (peace and blessings be upon him) say: "Do not sit on graves, and do not pray facing them."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 4276
Sayyiduna Anas (may Allah be pleased with him) said: I was standing in prayer and there was a grave in front of me, which I was not aware of. Sayyiduna Umar (may Allah be pleased with him) called out to me: "The grave, the grave!" I kept thinking he was saying "the moon". Those near me told me that he meant "the grave", so I moved away from it.
(b) Sayyiduna Ibn Abbas (may Allah be pleased with them both) disliked praying facing a toilet, a bathhouse or a grave.
(c) All of this is by way of dislike, as long as no impurity is known in the spot that one's body and clothes touch, because of what is established from the Prophet (peace and blessings be upon him) in the hadith: "The earth has been made pure, a means of purification and a mosque for me; so any man whom the time of prayer reaches should pray wherever he is."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 4277
Ibn Jurayj (may Allah have mercy on him) said: I asked Nafi' (may Allah have mercy on him): Did Ibn Umar (may Allah be pleased with them both) dislike praying in the middle of graveyards? He said: We prayed over Sayyidah Aishah (may Allah be pleased with her) and Umm Salamah (may Allah be pleased with her) in the middle of the Baqi' graveyard; the imam was Abu Hurayrah (may Allah be pleased with him), and Ibn Umar (may Allah be pleased with them both) was also present.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 4278
Hadith Gradingمحدثین:حسن
Hadith Takhrij«حسن۔ اخرجه يعقوب بن سفيان في المعرفه والتاريخ 1/78»