We are talking here about what is permissible for a Muslim to say when he is inflicted by a calamity in himself, his children, money or something of the like. It should be known that the laws of Allah are static and of His static Laws is to try His Servants with different kinds of afflictions and troubles in this world.
Sometimes He tries them with poverty and sometimes with richness, with health and another with sickness, and with happiness and another time with harm. The conditions of people vary from someone who is inflicted by loss of a beloved person, a calamity, or the missing of a desirable thing. The joys of life are like dreams or a transit shadow; so if the world pleases sometimes, it saddens other times. If it gives sometimes, it prevents other times. Ibn Mas`ud (may Allah be pleased with him) said: "For every joy there is sorrow, and there is no house is filled by joy but it will be filled by sorrow [someday]." However, the conditions of a Muslim are all good as the Prophet (peace be upon him) said: "Strange are the ways of a believer for there is good in every affair of his and this is not the case with anyone else except in the case of a believer for if he has an occasion to feel delight, he thanks (God), thus there is a good for him in it, and if he gets into trouble and shows resignation (and endures it patiently), there is a good for him in it." [Reported by Muslim in his Sahih No. 2999].
Allah guided His Servants to the condition which they should have at calamity, and guided them to Adhkar which they should recite. Allah (Glory be to Him) says: "And certainly, We shall test you with something of fear, hunger, loss of wealth, lives and fruits, but give glad tidings to As-Sâbirûn (the patient). * Who, when afflicted with calamity, say: Truly! To Allâh we belong and truly, to Him we shall return. * They are those on whom are the Salawât (i.e. who are blessed and will be forgiven) from their Lord, and (they are those who receive His) Mercy, and it is they who are the guided ones." [Surat Al Baqarah: 155 - 157].
So, Allah (Glory be to Him) told His Servants in this Ayah that He shall try His Servants with adversities to distinguish the truthful from the liar, and the impatient from the patient, and the certain from the skeptic. Then He mentioned some of His Inflictions: He tries them with some fear from enemies, hunger (the shortage of food and nutrition), and lack of money which includes all kinds of lacking whether by a natural calamity, drowning, loss, steal, or something else. Moreover, He tries them with the loss of their beloved ones: Children, relatives, and friends and also all kinds of diseases that inflict the body. Furthermore, He also inflicts them with the shortage of cereals, fruits, and trees; all these things should take place because the All-Knowing had told the people with their occurrence.
The real test for man is his condition when he is inflicted by a calamity, so the one who satisfies, shall be pleased, but the one who dissatisfies, shall be wretched. Therefore, a distressed person should know that the one who inflicts him with calamities is the All-Wise and the Most Merciful, moreover he should know that Allah did not send calamities and inflictions to destroy him but to try his patience and faith, and to hear his invocations and beseech. When he knows this, he shall have the great reward which Allah has prepared for him and grants him blessings and favors: "but give glad tidings to As-Sâbirûn (the patient). * "Who, when afflicted with calamity, say: Truly! To Allâh we belong and truly, to Him we shall return. * They are those on whom are the Salawât (i.e. who are blessed and will be forgiven) from their Lord, and (they are those who receive His) Mercy, and it is they who are the guided ones." [Surat Al Baqarah: 155 - 157]; how great favor and bounty it is! `Umar ibn Al Khattab (may Allah be pleased with him) said: "How just is Allah and how great is the reward!"
Allah made the phrase of "Inna Lillah wa Inna Ilayhi Raji`un [We belong to Allah and to Him we shall return]" a shelter and refuge for the distressed people, so when a distressed person says this phrase which includes all meanings of goodness and blessing, his heart becomes at ease, his soul gets comfort, and Allah compensates for Him.
Imam Muslim reported in his Sahih on the authority of Um Salamah (may Allah be pleased with her) that she said: I heard the Messenger of Allah (peace be upon him) saying: "When a person suffers from a calamity and utters: `Inna lillahi wa inna ilaihi raji`un. Allahumma ujurni fi musibati, wakhluf li khairan minha (We belong to Allah and to Him we shall return. O Allah! Compensate me in my affliction, recompense my loss and give me something better in exchange for it), then Allah surely compensates him with reward and better substitute.'' Umm Salamah (May Allah be pleased with her) said: When Abu Salamah (May Allah be pleased with him) died, I repeated the same supplication as the Messenger of Allah (peace be upon him) had commanded me (to do). So Allah bestowed upon me a better substitute than him (I was married to Muhammad, the Messenger of Allah (peace be upon him))." [Sahih Muslim: No. (918)].
Whoever ponders over this great phrase finds it containing a great cure for the distressed, but rather contains the instant greatest useful cure because this phrase has great benefits and results in this world and in the Hereafter; it is enough benefit the saying of Allah: "They are those on whom are the Salawât (i.e. who are blessed and will be forgiven) from their Lord, and (they are those who receive His) Mercy, and it is they who are the guided ones." [Surat Al Baqarah: 157].
However, a Muslim should understand its meaning to get that generous promise and great reward. This phrase includes two great fundamentals if a person ascertain them, he shall have the great reward.
As for the first fundamental, a person should know that himself, his children, family, and money belong to Allah (Glory be to Him), for He is the one who created them out of nothing and disposes them as He wills without any objection from His Servants; and that is taken form Allah's Saying: "We belong to Allah" i.e., we are His Slaves and under His Control. He is our Lord and everything befalls on us is by His Destiny. "No calamity befalls on the earth or in yourselves but is inscribed in the Book of Decrees (Al-Lauh Al-Mahfûz) before We bring it into existence. Verily, that is easy for Allâh." [Surat Al Hadid:22].
The second fundamental is: A person should know that his final destination and returning is to Allah as He says: "And that to your Lord (Allâh) is the End (Return of everything)." [Surat An-Najm: 42]. Allah (Exalted be He) says: "Surely, to your Lord is the return." [Surat of Al `Alaq: 8]. So, a person should forget about the world and focus on the Hereafter because he shall return to Allah alone as he was created alone without family, money, or clan, but he comes to Him with good deeds and bad deeds, and that is taken from Allah's Saying: "To Allah we belong and to Him we shall return" which is a confession from a person that he shall return to Allah for retribution. Therefore, a person should busy himself with the things that benefit when he meets his Lord. If a distressed person says this phrase as was described, pondering over its meaning, he shall be guided to the Straight Path.
Abu Nu`aym reported in Al Hilyah on the authority of Al Hasan ibn `Ali Al `Abid who said: Al Fudayl ibn `Iyad asked a man: How old are you? He replied: Sixty years old. He said: You have been walking to Allah for sixty years, you shall reach soon. The man said: O Abu `Ali, we belong to Allah and to Him we shall return. Al Fudayl ibn `Iyad said: Do you know its meaning? The man said: What is its meaning, O Abu `Ali? He said: Your saying: "We belong to Allah" means I am a servant to Allah and to Him I shall return. So, whoever knows that he is a servant and to Allah he shall return should know that he shall stand before Him for reckoning. And who knows that he shall stand before Him for reckoning should prepare answers for the questions. The man said: What is the way out? He said: very simple. He said: What is it? He said: Do good for the rest of your life, the past shall be forgiven, for if you do bad in the rest, you shall be punished for the past and the coming. [Hilyat Al Awliya': 8/113].
This indicates the great care of the Pious Predecessors (may Allah bestow mercy on them) for the meaning of Adhkar, knowing their significance, and ascertaining their meanings and ends. They stress on understanding these meanings to get the great reward in the Hereafter and the favors in the world.