Reference: Fataawa li Ahlil-Mayyit – Question 32, Page 36
Fataawa al-Lajnah ad-Daa.imah lil-Buhooth al-‘Ilmiyyah wal-Iftaa – Volume 9, Page 134
Question: Someone died and we went to bury him, and [afterwards] some of us offered our condolences to the relatives of the deceased at the graveside. So is this permissible?
Response: This is permissible, and there is no specific time nor place [legislated] in which to offer condolences.
And with Allaah lies all the success, and may Allaah send prayers and salutations upon our Prophet Muhammad (sal-Allaahu ‘alayhi wa sallam) and his family and his companions.