For the Prophet ﷺ forbade sitting on graves and said: “For one of you to sit on a live coal that burns through his clothes and reaches his skin is better for him than sitting on a grave.” (1)
The same applies to walking upon it. The author is of the view that this is disliked.
The correct view, however, is that it is forbidden, because the Prophet ﷺ forbade it (2), and because it is a desecration of one’s Muslim brother.
His statement, “and leaning against it,” means leaning against the grave and treating it as though it were a pillow, for this entails disrespect for the grave.
Consider how the Prophet ﷺ forbade “plastering a grave, building over it, writing upon it, and walking upon it” (3). In this prohibition, he combined that which may lead to excess concerning graves with that which may lead to their desecration.
Excess lies in building over graves, plastering them, and writing upon them; while desecration lies in walking upon them. This is so that people may treat those in the graves with moderation, neither excess nor neglect.
His statement, “It is forbidden to bury two or more in it except out of necessity,” means that it is forbidden to bury two or more persons in one grave, whether they are two men, two women, or a man and a woman.
The evidence for this is the practice of the Muslims, from the time of the Prophet ﷺ until our own day: a person is buried alone in his grave.