The majority of scholars have said that it is recommended for those accompanying a burial to sit by the grave for a short amount of time afterwards. This is because of what has been narrated about the Prophet (pbuh) that one time he buried a Companion and said to those in attendance afterwards, “Ask forgiveness for your brother and ask that ask that he is made firm because right now he is being questioned” (Abu Dawud).
It is also said in this regard that Ibn Umar held it to be recommended to recite the beginning and end of Surah al-Baqarah at the gravesite after the burial.
And it is narrated from Amr ibn al-As that when he was on his death bed he advised those present saying, “When I’m buried sit by my grave for the amount of time it takes to slaughter and process a camel because I will be made at ease through your company.”
*Taken from the Kuwaiti Fiqh Encyclopedia