Allah's Messenger (ﷺ) forbade that the graves should be plastered or they be used as sitting places (for the people), or a building should be built over them.
The Book of Prayer - Funerals
Sahih Muslim 970 a
Hadith Text
Allah's Messenger (ﷺ) forbade that the graves should be plastered or they be used as sitting places (for the people), or a building should be built over them.
Scholarly Commentary
This noble hadith contains three important prohibitions regarding graves: plastering them, using them as sitting places, and constructing buildings over them. The wisdom behind these prohibitions is to prevent exaggeration in venerating the deceased and to safeguard against practices that may lead to shirk (associating partners with Allah).
Plastering graves and building structures over them was a practice of the People of the Book and the pre-Islamic Arabs who would exaggerate in honoring their dead, eventually leading to worship of graves. The Prophet (ﷺ) prohibited this to protect the purity of Islamic monotheism.
Sitting on graves is forbidden out of respect for the deceased and to avoid imitating those who worship graves. The deceased in their graves are either receiving mercy or punishment, and sitting on their graves shows disrespect to their condition.
These prohibitions serve as a fence around tawheed (monotheism) and prevent the Muslim ummah from falling into the errors of previous nations who transformed graves into places of worship and shirk.