Ruling on walking in the graveyard wearing shoes
Question

                What is the ruling on walking in the graveyard wearing shoes?.
Praise be to Allah.
    Firstly: 

    The Sunnah for the one who enters the graveyard is to take 
    off his shoes when he enters, but if the ground is thorny and will hurt him 
    and so on, then there is nothing wrong with keeping his shoes on. 

    Ibn Qudaamah (may Allaah have mercy on him) said in 
    al-Mughni (2/224): He should take off his shoes when he enters the 
    graveyard. This is mustahabb, because of the report narrated by Basheer ibn 
    al-Khasaasiyah who said: Whilst I was walking with the Messenger of Allaah 
     (peace and blessings of Allaah be upon him), we saw a man who was 
    walking among the graves, wearing shoes. He said: “O you with the two shoes, 
    take them off.” The man looked, and when he recognized the Messenger of 
    Allaah  (peace and blessings of Allaah be upon him) he took them off and 
    threw them aside. Narrated by Abu Dawood. End quote. 

    The scholars of the Standing Committee for Issuing Fatwas 
    were asked: Is taking off one's shoes in the graveyard Sunnah or bid’ah (an 
    innovation)? 

    They replied: It is prescribed for the one who enters the 
    graveyard to take off his shoes, because of the report narrated by Basheer 
    ibn al-Khasaasiyah (may Allaah be pleased with him) who said: … and they 
    quoted the hadeeth. Then they said: Ahmad said: The isnaad of the hadeeth of 
    Basheer ibn al-Khasaasiyah is jayyid and I would follow it unless there was 
    a reason not to. And the reason referred to by Ahmad (may Allaah have mercy 
    on him) is things such as thorns or the ground being too hot to walk on and 
    the like, in which case there is nothing wrong with wearing shoes when 
    walking between the graves, so as to avoid harming oneself. 

    And Allaah is the Source of strength. May Allaah send 
    blessings and peace upon our Prophet Muhammad and his family and companions. 
    End quote. 

    Fataawa al-Lajnah al-Daa’imah li’l-Ifta 
    (9/123-124). 

    Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) said: 
    Walking between the graves wearing shoes is contrary to the Sunnah, and it 
    is better to take off one’s shoes when walking between the graves, except in 
    cases of necessity, such as if there are thorns in the graveyard or it is 
    very hot, or there are pebbles which will hurt one, in which case there is 
    nothing wrong with it, i.e., wearing shoes when walking between the graves. 
    End quote. 

    Majmoo’ Fataawa  Ibn ‘Uthaymeen 
    (17/202).