All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
Praying the funeral prayer after the ʻAsr is valid. We have previously underlined in fatwa 84124 that it is permissible to hold the funeral prayer after the ʻAsr because the funeral prayer is a prayer done for a specific reason. An-Nawawi said about praying at the times when it is forbidden to pray, "It is not disliked to perform the voluntary prayers that have specific reasons ... so he may perform a prayer that he has vowed to perform, the funeral prayer, Sujood At-Tilaawah (prostration during the recitation of the Quran), Sajdat ash-Shukr (prostration of thankfulness), the Kusoof (eclipse) prayer, and the Tawaaf (circumambulation) prayer..." [Al-Majmooʻ]
As for taking off their shoes, a group of scholars held that it is recommended to take off the shoes upon entering a graveyard. Ibn Qudaamah said:
"It is recommended for the visitor of the graveyard to take off his shoes. Basheer ibn Al-Khasaasiyyah said, 'While I was walking with the Messenger of Allah, sallallaahu ‘alayhi wa sallam, we saw a man walking among the graves, wearing shoes. He, sallallaahu ‘alayhi wa sallam, said, ‘O the one wearing the shoes! Take off your shoes.’ The man looked around, and when he recognized the Messenger of Allah, sallallaahu ‘alayhi wa sallam, he took them off and threw them away.' [Abu Daawood] ... and because taking off the shoes in this situation is closer to the state of humility and humble submission and respect for the dead Muslims..." [Al-Mughni]
For more benefit, please refer to fatwa 93793.
The recommendation to take off the shoes in the graveyard is not confined to the time when the visitor is supplicating for the dead; rather, it is recommended to take them off upon entering the graveyard. Taking the shoes off specifically when supplicating is considered a religious innovation.
It is prescribed to supplicate Allah in favor of the person buried in the grave, and there is no harm in facing the prayer direction when supplicating. The Kuwaiti Encyclopedia of Fiqh reads:
"Etiquette of visiting the graveyard: The Hanafis held that it is an act of the Sunnah to stand when visiting the grave and to stand while supplicating there, as the Prophet, sallallaahu ‘alayhi wa sallam, used to do when visiting Al-Baqeeʻ graveyard. He used to say, 'Assalaamu alaykum ya ahl al-quboor; yaghfiru Allahu lana wa lakum. Antum salafuna wa nahnu bil-athar.' (Peace be upon you, O inmates of the graves. May Allah forgive us and you. You have preceded us, and we are to follow.) Another version of the supplication reads, 'Assalaamu alaykum ahl ad-diyaari min al-mu’mineena wal-Muslimeen, wa inna in shaa’ Allahu bikum laahiqoon. Nas’alu Allaha lana wa-lakum al-ʻaafiyah.' (Peace be upon you, O inmates of the abodes of the believers and the Muslims. We shall follow you if Allah wills. We ask Allah for wellbeing for ourselves and for you.) He, sallallahu ‘alayhi wa sallam, used to recite this supplication and supplicate Allah in favor of the dead for long periods of time while standing up. Sharh Al-Munyah reads, 'He supplicates while standing and facing the prayer direction. It was also said: facing the face of the deceased (i.e. the grave).'
The Shaafiʻis held that it is recommended for the visitor to say, 'Assalaamu alaykum daara qawmin mu’mineen wa inna in shaa’ Allahu bikum laahiqoon. Allahumma la tahrimna ajrahum wa la taftinna ba‘dahum.' (Peace be upon you, O the abode of believing people, and we – Allah willing – shall join you. O Allah, do not deprive us of their reward, and do not put us to trial after them.) It is recommended to recite some of the Quran and supplicate Allah in favor of the dead and greet the deceased he is visiting from the side of his face. It is also recommended for the visitor to face the prayer direction during the supplication. The scholars of Khurasaan held that the visitor should face the deceased's face during the supplication, and this is the view upon which we act.
The Hanbalis held that it is an act of Sunnah for the visitor to stand near the grave and say, 'Assalaamu alaykum daara qawmin mu’mineen (or ahla ad-diyaar min al-mu’mineen) wa inna in shaa’ Allahu bikum la-laahiqoon. Yarham Allahu al-mustaqdimeen minkum wa al-musta’khireen. Nas’alu Allaha lana wa lakum al-ʻaafiyah. Allahumma la tahrimna ajrahum wa la taftinna baʻdahum waghfir lana wa lahum.' (Peace be upon you, O abode of believing people, and we – Allah willing – will join you. May Allah have mercy upon those of you who have gone on ahead of us and those who will go later on. We ask Allah to bless us and you with wellbeing. O Allah, do not deprive us of their reward, and do not put us to trial after them and forgive us and them.)..."
Allah knows best.