وَحَدَّثَنِي زُهَيْرُ بْنُ حَرْبٍ، حَدَّثَنَا جَرِيرٌ، عَنْ سُهَيْلٍ، عَنْ أَبِيهِ، عَنْ أَبِي هُرَيْرَةَ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ لأَنْ يَجْلِسَ أَحَدُكُمْ عَلَى جَمْرَةٍ فَتُحْرِقَ ثِيَابَهُ فَتَخْلُصَ إِلَى جِلْدِهِ خَيْرٌ لَهُ مِنْ أَنْ يَجْلِسَ عَلَى قَبْرٍ ‏"‏ ‏.‏
Translation
Abu Marthad al-Ghanawi reported Allah's Messenger (ﷺ) as saying

Do not pray facing towards the graves, and do not sit on them.

Comment

The Book of Prayer - Funerals

Author: Sahih Muslim | Hadith Reference: Sahih Muslim 972 b

Prohibition of Facing Graves in Prayer

The prohibition against praying facing graves serves to protect the purity of Islamic monotheism. Prayer (salah) is directed solely to Allah, and facing graves during this sacred act could lead to shirk (associating partners with Allah) or resemble the practices of earlier nations who venerated their dead excessively.

This prohibition applies to all graves, whether of righteous people or otherwise, as the fundamental principle is to prevent any means that might lead to exaggeration in honoring the deceased beyond what is legislated in Shariah.

Prohibition of Sitting on Graves

The prohibition against sitting on graves demonstrates the Islamic respect for the deceased and their resting places. Sitting on graves shows disrespect to the dead and violates the sanctity of their burial places.

This ruling also serves to distinguish Muslim practice from those of the People of the Book who would frequent gravesites and sit upon them, often engaging in inappropriate practices. The Muslim ummah is commanded to honor the dead while maintaining proper boundaries.

Wisdom Behind These Prohibitions

These prohibitions collectively serve to: preserve pure tawheed (monotheism), prevent practices that could lead to shirk, maintain the dignity and honor of the deceased, distinguish Islamic practices from non-Islamic ones, and ensure that acts of worship remain purely for Allah without any innovation or deviation.

The comprehensive nature of these rulings reflects the perfection of Islamic legislation in guiding believers in all aspects of life and death, ensuring both proper respect for the deceased and protection of correct belief and practice.