Are Gravestones Prohibited in Islam?
Question

The custom in our country is to put a stone, concrete or a peg at the head and foot of the grave, or sometimes just at the head. What is the Islamic ruling on that?
Praise be to Allah.Prohibition on building structures over graves
Islam forbids building structures over graves , and commands that any such structures should be knocked down. But it is permitted to put a marker on the grave so that the family and friends of the deceased will know where it is. However, this marker should not be a structure or anything else that is not allowed in the Shari`ah. 
Evidence for the prohibition on building structures over graves
With regard to the prohibition on building structures over graves , the evidence for that is as follows. 
It was narrated that Jabir said: The Messenger of Allah (peace and blessings of Allah be upon him) forbade plastering over graves, sitting on them and building structures over them. (Narrated by Muslim, 970)
Ash-Shawkani (may Allah have mercy on him) said: “The phrase “building structures over them: indicates that it is haram to build anything over a grave . 
Ash-Shafi`i (may Allah have mercy on him) and his companions made the following distinction: if the structure is built on the property of the person who builds it, it is disliked, and if it is in a public graveyard, it is prohibited. However, there is no evidence for making this distinction. 
Ash-Shafi`i said: I saw the Imams in Makkah ordering that what had been built (over graves ) was to be knocked down. 
The Hadith of `Ali also indicates that such structures should be destroyed.” (Nayl Al-Awtar, 4/132; the view of Ash-Shafi`i is mentioned in Al-Umm, 1/277) 
The Hadith of `Ali referred to will be quoted below.
Evidence for the command to knock down structures built over graves
With regard to the command to knock down structures that have been built over graves , that is proven in the Sunnah. 

It was narrated that Abul-Hayaj As-Asadi said: `Ali ibn Abu Talib said to me: “Shall I not send you on the same mission as the Messenger of Allah (peace and blessings of Allah be upon him) sent me? Do not leave any statue without erasing it, and do not leave any raised grave without leveling it.”  (Narrated by Muslim, 969). 

Ash-Shawkani (may Allah have mercy on him) said: 
The words “do not leave any raised grave without leveling it” means that the Sunnah is that a grave should not be made very high, and there should be no differentiation between those who were virtuous and those who were not virtuous. 
It seems that making a grave higher than the amount that is permitted is prohibited. This was clearly stated by the companions of Ahmad and a group of the companions of Ash-Shafi`i and Malik. 
The view that it is not prohibited because the earlier and later generations did that without anyone denouncing that action, as Imam Yahya and Al-Mahdi said in Al-Ghayth, is not correct, because the most that can be said is that they kept quiet about it, and keeping quiet does not count as evidence if it has to do with matters which are not definitive, and the prohibition of making graves high is not definitive. 
Making graves high that is mentioned in the Hadith especially includes the domes and shrines that are built over graves, and the taking of graves as places of worship. The Prophet (peace and blessings of Allah be upon him) cursed those who do that. (Nayl Al-Awtar, 4/130) 
Are gravestones prohibited in Islam?
With regard to it being permissible to mark a grave with something permissible, there is evidence in the Sunnah which explains that. 
It was narrated from Kathir ibn Zayd Al-Madani that Al-Muttalib said: When `Uthman ibn Madh`un died, his bier was brought out and he was buried, then the Prophet (peace and blessings of Allah be upon him) ordered a man to bring a rock but he was not able to carry it. So the Messenger of Allah (peace and blessings of Allah be upon him) stood up and rolled up his sleeves. Kathir said: Al-Muttalib said: the one who narrated that to me from the Messenger of Allah (peace and blessings of Allah be upon him) said: it is as if I can see the whiteness of the arms of the Messenger of Allah (peace and blessings of Allah be upon him) when he rolled up his sleeves. Then he carried it and placed it at the head (of the grave), and said, “From this I will recognize the grave of my brother, and I can bury those among my family who die near him.” (Narrated by Abu Dawud, 3206) 
The chain of narrators  of this Hadith was classed as sound by Al-Hafidh ibn Hajar in At-Talkhis Al-Habir, 2/133) 
Ibn Qudamah (may Allah have mercy on him) said: 
There is nothing wrong with marking a grave with a stone or a piece of wood. There is nothing wrong with a man marking a grave so that he will know where it is. The Prophet (peace and blessings of Allah be upon him) marked the grave of `Uthman ibn Madh`un. (Al-Mughni, 2/191)
 And Allah knows best.