It is obligatory upon the relatives of the deceased to be patient and to say إنا لله وإنا إليه راجعون
➊ Allah the Most High says:
وَلَنَبْلُوَنَّكُمْ بِشَيْء مِنَ الْخَوْفِ وَالْجُوعِ وَنَقْصٍ مِّنَ الْأَمْوَالِ وَالْأَنْفُسِ وَالثَّمَرَاتِ وَبَشِّرِ الصَّبِرِينَ الَّذِينَ إِذَا أَصَابَتْهُمْ مُصِيبَةٌ قَالُوا إِنَّا لِلَّهِ وَإِنَّا إِلَيْهِ رَاجِعُونَ
“We will surely test you in one way or another, with fear of the enemy, with hunger and thirst, with a decrease in wealth, lives and fruits. And give glad tidings to those who are patient, who, when a calamity befalls them, say: إنا لله وإنا إليه راجعون (We belong to Allah Himself, and to Him we will return).”
➋ The Messenger of Allah ﷺ sat by a grave and said to a woman who was weeping: اتقى الله واصبري “Fear Allah the Most High and be patient.” And he also said: ان الصبر عند الصدمة الأولى “Indeed, patience is at the first shock.”
Along with إنا لله وإنا إليه راجعون, it is also sunnah to recite these words:
اللهم أجُرُنِى فِى مُصِيبَتِي وَاخْلِفٌ لِي خَيْرًا مِّنْهَا