Condolences are desirable, even if the deceased was a non-Muslim. Ibn Majah and Al-Baihaqi reported from ‘Amr ibn Hazm that the Prophet, peace be upon him, said: “Every believer who consoles his brother in distress, will be dressed by Allah in an apparel of honour on the Day of Resurrection.” It is recommended, however, that the condolences be offered only once.
The condolences should be offered to the entire family of the deceased, that is, to all the relatives, old and young, men and women. (The scholars exclude from this list beautiful young women. Only their mahram relatives may offer condolences to them) One may offer condolences either before or after the burial up to three days after death. If the person either offering or receiving condolences was not present at the time of death, condolences may be offered even at a later period.