Earthquakes are one of the great signs of Allah in this universe, with which He tests His slaves as a reminder or to instil fear of Him or as a punishment. Man must remember, when the signs occur, his weakness, incapability, humble status before Allah and his need of Him, so he turns to Allah, may He be exalted and glorified, in supplication, beseeching and humility, in the hope that Allah will lift this great distress from the people.
Allah says (interpretation of meaning):
16.Do you feel secure that He, Who is over the heaven (Allâh), will not cause the earth to sink with you, then behold it shakes (as in an earthquake)?
17. Or do you feel secure that He, Who is over the heaven (Allâh), will not send against you a violent whirlwind? Then you shall know how (terrible) has been My Warning? [067:16-17]
Allah says (interpretation of meaning):
42. Verily, We sent (Messengers) to many nations before you (O Muhammad). And We seized them with extreme poverty (or loss in wealth) and loss in health with calamities so that they might believe with humility.
43. When Our Torment reached them, why then did they not believe with humility? But their hearts became hardened, and Shaitân (Satan) made fair¬seeming to them that which they used to do.
44. So, when they forgot (the warning) with which they had been reminded, We opened to them the gates of every (pleasant) thing, until in the midst of their enjoyment in that which they were given, all of a sudden, We took them to punishment, and lo! They were plunged into destruction with deep regrets and sorrows.
Shaykh Ibn Baaz (may Allaah have mercy on him) said:
What must be done at the time of an earthquake or other calamity, or an eclipse, strong wind or flood is to repent to Allah, may He be glorified, and to beseech Him and ask Him for well-being, and to remember Him a great deal and ask Him for forgiveness, as the Prophet (pbuh) said at the time of an eclipse: “When you see that, then turn to remembrance of Allah and call upon Him and ask for His forgiveness.”
It is also mustahabb to show compassion to the poor and needy, and to give charity to them, because the Prophet (pbuh) said: “Show mercy, you will be shown mercy.” (Narrated by Ahmad) And he said: “Those who show mercy will be shown mercy by the Most Merciful. Show mercy to those who are on earth and the One Who is in heaven will show mercy to you.” Narrated by al-Tirmidhi. Prophet (pbuh) said: “The one who does not show mercy will not be shown mercy.” Narrated by al-Bukhaari. It was related from ‘Umar ibn ‘Abd al-‘Azeez (may Allaah have mercy on him) that he used to write to his emirs when earthquakes took place telling them to give charity.
One of the means of being safe and sound from all evils is for those in authority to hasten to restrain the foolish and compel them to adhere to the truth, and to implement the laws of Allaah among them, and to enjoin what is good and forbid what is evil, as Allah says (interpretation of the meaning):
“The believers, men and women, are Auliyâ’ (helpers, supporters, friends, protectors) of one another, they enjoin (on the people) Al-Ma’rûf (i.e. Islâmic Monotheism and all that Islâm orders one to do), and forbid (people) from Al-Munkar (i.e. polytheism and disbelief of all kinds, and all that Islâm has forbidden); they perform As-Salât (Iqâmat-as-Salât) and give the Zakât, and obey Allâh and His Messenger. Allâh will have His Mercy on them. Surely Allâh is All-Mighty, All-Wise.” [al-Tawbah 9:71]
40.“Verily, Allâh will help those who help His (Cause). Truly, Allâh is All-Strong, All-Mighty.
41. Those (Muslim rulers) who, if We give them power in the land, (they) order for Iqamat-as-Salât. [i.e. to perform the five compulsory congregational Salât (prayers) (the males in mosques)], to pay the Zakât and they enjoin Al-Ma’rûf (i.e. Islâmic Monotheism and all that Islâm orders one to do), and forbid Al-Munkar (i.e. disbelief, polytheism and all that Islâm has forbidden) [i.e. they make the Qur’ân as the law of their country in all the spheres of life]. And with Allâh rests the end of (all) matters (of creatures). [al-Hajj 22:40-41]
“And whosoever fears Allah and keeps his duty to Him, He will make a way for him to get out (from every difficulty).
3. And He will provide him from (sources) he never could imagine. And whosoever puts his trust in Allâh, then He will suffice him. Verily, Allâh will accomplish his purpose. Indeed Allâh has set a measure for all things.” [al-Talaaq 65:2-3]
Allah know the best