“It is very important to note that there is nothing wrong in carving names on graves to mark them. The ruling on carving Qur’anic verses ranges from makruh (disliked) to haram (prohibited). It is preferable, therefore, not to carve Qur’anic verses as an act of honoring the Words of Allah.
Sheikh Jad Al-Haqq `Ali Jad Al-Haqq, the late Grand Sheikh of Al-Azhar, stated: It is permissible to mark graves with a stone or a stick; we learn this from the hadith narrated by Ibn Majah. In that hadith, Anas reported that the Prophet (peace and blessings be upon him) said: “I could know the grave of Ibn Maz`un by a stone marking it.”
Furthermore, the Prophet (peace and blessings be upon him) is reported to have < b>prohibited covering graves with plaster, sitting on or building over them. In another version, he prohibited stepping on graves as well. In the version of An-Nasa’i, the Prophet prohibited building over graves, adding to them, covering them with plaster, or writing on them.
This shows that it is prohibited to carve anything whatsoever on graves. According to Imam Ahmad and Ash-Shaf`i, the command not to write is to be understood as making it makruh (disliked) whether what to be carved is the Qur’an or the name of buried person. Nevertheless, Shaf`i scholars added that it is commendable to write the name or mark the grave of a great scholar or righteous figure.
Imam Malik said that carving Qur’anic verses on graves is haram, whereas carving the name and the date of death is makruh. Hanafi scholars said that carving on graves is prohibitively disliked unless it is done to mark the existence of the grave. Moreover, Ibn Hazm said that carving the name of the dead person on a rock is not makruh>.
According to the above mentioned hadiths, carving Qur’anic verses on graves is haram, particularly when these graves are levelled with the ground and people may step on them.
Therefore, people in charge of the graveyard should erase all carved Qur’anic verses that could be stepped on by visitors, as an act of honouring the holiness of the Qur’an. By way of analogy, it is allowed to mark graves by carving names or putting a tombstone. This is made permissible according to what the Prophet (peace and blessings be upon him) did when he marked the grave of Ibn Maz`un by a stone.”