It is not permissible to sit on a grave, or lean on it, or walk over it. This is based on a hadith reported by ‘Amr bin Hazm who said: “The Prophet, peace be upon him, saw me leaning on a grave, so he said: ‘Do not harm the dweller in this grave or do not harm him.”’ (Reported by Ahmad, who considers its chain of narrators as sound) Abu Hurairah reported: “The Prophet, peace be upon him, said: ‘It is better for you to sit on a glowing coal that burns through your clothes to your skin than to sit on a grave.” (Reported by Ahmad, Muslim, Abu Daw’ud, Nasa’i, and Ibn Majah) In the opinion of Ibn Hazm this statement amounts to an outright prohibition because of the warning contained in it. He said this is the opinion of a group of the early Muslims of whom Abu Hurairah is one.
The majority of scholars hold that such an act is merely disapproved. An-Nawawi said: “Ash-Shafi’i (See Al-Shafi’i’s work Al-Umm) and the companions mentioned in various narrations disapprove of sitting on a grave, holding it to be makruh tahrimi, (Makruh is divided into makruh tahrimi “that which is nearly unlawful without it being actually so,” and makruh tanzihi “that which approaches the lawful.”) a term well-known to jurists. The majority of scholars including An-Nakha’i, Al-Laith, Ahmad, and Daw ‘ud hold this view.They also disapprove of reclining or leaning on a grave.”
Ibn ‘Umar, Abu Hanifah, and Malik are of the opinion that it is permissible to sit on a grave. Malik said: “We think that prohibition of sitting and leaning on graves means prohibition of using them to answer the call of nature.” (Al-Muwatta) He cited a weak hadith in this regard. Ahmad considers the interpretation of Malik weak and said: “This is not an argument.” An-Nawawi said that this interpretation is weak or false. Likewise, Ibn Hazm regards it invalid for a number of reasons. This difference of opinion concerns sitting on graves. However, there is agreement among the jurists, however, that sitting on the graves to answer the call of nature is unlawful. The jurists also agree on the permissibility of walking over graves if necessary, when for instance, there is no other way of reaching the grave of one’s dear one.