Those who take beings other than Allah to be their god, in other words, idolaters, also pray to Allah from time to time. However, idolaters' prayers are quite different from that of believers'. Idolaters remember that they are in need of Allah only in times of trouble and only pray to be saved from it.
However, at every moment of one's life, people are in need of Allah. The difference between the prayer of a believer and an idolater emerges right at this point. Believers turn to Allah under all circumstances and at all times. For them to turn to Allah in prayer, believers do not wait for hard times. Because they feel the need to draw near to Allah, they pray at every moment.
Idolaters' telling attribute is their ingratitude and hypocrisy towards Allah. In times of trouble and distress, they turn purely to Allah and pray. When the distress is removed, they totally forget Allah, as if it were not they who had called on Him. This is because they assume that some beings other than Allah hold control over the occurrence of events. They are not aware that everything on earth happens by Allah's Will. Due to this shallow outlook, they forget that whatever they hope for is already under Allah's control. When they get sick, for instance, they think it is the doctors, medicine or the advanced technology employed by the hospital that will cure them. They fail to think that it is Allah Who heals every disease, and Who creates the medicine and the doctors. When the doctors and medicine on which they rely so much fail, only then do they think about taking refuge in Allah, something they had never thought of before. The fact is, it is Allah alone Who heals a person. The people of ignorance, however, can never grasp this fact. They show ungratefulness. One verse explains this ingratitude as follows:
When harm touches man, he calls on Us, lying on his side or sitting down or standing up. Then when We remove the harm from him he carries on as if he had never called on Us when the harm first touched him. In that way We make what they have done appear good to the profligate. (Surah Yunus: 12)
The fact that a person remembers Allah at his most difficult times indicates a certain fact: he already knows that Allah is the only One in whom he can take refuge. When faced with distress, this fact that has been disregarded until then-since it challenged his personal interests-is recalled. However, when saved from it, he again returns to ingratitude. In the Qur'an Allah relates this situation with an example:
It is He Who conveys you on both land and sea so that when some of you are on a boat, running before a fair wind, rejoicing at it, and then a violent squall comes upon them and the waves come at them from every side and they realize there is no way of escape, they call on Allah, making their religion sincerely His: "If You rescue us from this, we will truly be among the thankful."
But then, when He does rescue them, they become rebellious in the earth without any right to do so. Mankind, your rebelliousness is only against yourselves. There is the enjoyment of the life of the world and then you will return to Us and We will inform you about what you did. (Surah Yunus: 22-23)
It is quite hard to be saved from a ship that is about to sink in the midst of an ocean. In such a situation, a person faces certain death and none of the non-godly ideas upon which they relied until then are of any help. Only the One Who holds control over the sea, storm, ship and darkness can help them …and this is Allah, the Lord of Superior Might.
This simply means that all the agents one thinks they can turn to for help are powerless. This is an utterly desperate situation indeed. So a person on a sinking ship will suddenly start to pray, assured of Allah's existence and the fact that no one but Allah can save them. While praying, they humble themselves and turn to Allah in prayer. They fully comprehend that only Allah can save them from the desperate situation they are in and that they will never be saved unless Allah wills it.
People who don't normally pray to Allah, or even have denied His existence and who suddenly find themselves in this dire situation have, most probably, never thought about encountering death in this way before. They usually think of death as a distant possibility and thus remain indifferent towards life after death, and rely on their worldly supporters. Yet when faced with this dire situation of which they never before contemplated, the existence of these supporters become meaningless. Now, they do not falter in praying to Allah. At that moment they turn to Him in prayer, even if before they had always doubted the efficacy of asking for help from Him. No one reminds them now to pray to Allah, and indeed there is no need for this, for they know deep down, that it is Allah alone Who can help them.
Being so close to death, people will quickly review their life and imminent doom and suddenly start thinking about life after death; they will see that they have not engaged in deeds that are worthy of Paradise and suddenly this will be their greatest fear. They will think about how they spent their time in this life. They cannot now be arrogant nor any longer remain negligent or reckless towards issues concerning religion. They act as though they were not the ones who rejected Allah. Meanwhile, they are truly aware of their ungratefulness: that they feel the need to pray now that they are in a desperate situation indicates that, in actuality, they knew all along how they should be behaving. However, surprisingly, as the Qur'an informs us, a disbeliever who turns to Allah in these kinds of dire circumstances, acknowledging that Allah is the All-Mighty, all of a sudden loses his sincerity once the threat is over. In an amazing manner, they return to their former idolatrous ways. Their regret and relying on Allah is all of a sudden replaced by disbelief and ingratitude. They lapse back into their former state of heedlessness. The enlightenment they experienced in the face of danger suddenly disappears. With the security instilled by relief and the disappearance of danger, they never feel the need again to pray.
This abnormal psychology of the people of ignorance and their ingratitude is described in the Qur'an as follows:
Man never tires of praying for the good and if evil touches him, he despairs and loses hope. But if We let him taste mercy from Us after he has suffered hardship, then he says, "This is my due. I do not think that the Hour is going to come. And if am returned to my Lord, I will definitely find the best reward with Him." But We will inform those who disbelieve of what they did and make them suffer a ruthless punishment. When We grant blessing to a man, he turns away and draws aside but when any evil touches him, he is full of endless prayers! (Surah Fussilat: 49-51)
All these verses make mention of people who turn to Allah in trouble yet grow ungrateful when relieved. As said earlier, this is an attitude peculiar to idolaters, since the telling character trait of believers is their turning to Allah under all circumstances. Not only in times of difficulty, but also during times of ease and welfare, do they turn to Allah in prayer and glorify Him. They have assured faith in the fact that only Allah can help them.
Being ungrateful, as in the case of the one who prays to Allah in the ship but then becomes forgetful when relieved, is every soul's inclination. One of the purposes of this Qur'anic story about the ship is surely to condemn idolaters. However, everyone needs to take lessons from it and avoid assuming a similar attitude. That is to say, everyone needs to ponder this example, reconsider their own situation and sincerely correct their outlook.
Do you, for instance, ever consider your own situation?
Do you pray more strongly when you encounter a hardship, as in the case of the people in the ocean caught by a storm? Do you turn to Allah in prayer only when you encounter trouble? Do your prayers become more sincere in times of trouble? Are you prone barely to remembering Allah and paying less attention to prayer, when you are happy and relieved?
If this is the case, then you need to ponder your own situation. You need to draw lessons from this incident in the Qur'an, and strive not to be like the idolaters who prayed in the ship but then became ungrateful once relieved. You need to ask for forgiveness and repentance, for the duty of every person of faith is to avoid the character traits of disbelievers and idolaters and strive to assume the believers' character traits. One of these is their constant remembrance that they are Allah's servants, whether they are at ease or in trouble. They always turn to Allah in prayer and remain grateful.
We need to remember that praying only in times of trouble and hardship is an insincere attitude. Indeed, the Qur'an relates that even the most insolent people who revolted against Allah and His messenger prayed to Allah at very difficult times.
Pharaoh is the prototype of such a character. Pharaoh, who presented himself as a god in ancient Egypt and grew arrogant, treated the Prophet Musa (as) and his people cruelly and denied Allah, despite the many miracles he witnessed and the Prophet Musa's communication of Allah's message. Moreover, Pharaoh's denial and arrogance persisted until he met his death. Yet, once he realized that death was very near and that he had no hope for salvation, he started to pray desperately and claimed that he was also a Muslim-one who has submitted himself to Allah. This is related in the Qur'an as follows:
We brought the tribe of Israel across the sea and Pharaoh and his troops pursued them out of tyranny and enmity. Then, when he was on the point of drowning, he said, "I believe that there is no god but Him in Whom the tribe of Israel believe. I am one of the Muslims." "What, now! When previously you rebelled and were one of the corrupters? Today we will preserve your body so you can be a Sign for people who come after you. Surely many people are heedless of Our Signs." (Surah Yunus: 90-92)
Believers must also pay heed to this distorted understanding of prayer as related in the Qur'an. All believers who read the Qur'an are held responsible for its commandments, and with these verses, Allah warns believers and makes it clear that He expects His servants to include prayer in every aspect of their lives. This demonstrates a striking difference between the believers' understanding of prayer, and that of ignorant people. Believers are submissive to our Lord, the One Who grants infinite blessings. They are aware that their true friend and protector is Allah. For this reason, under all circumstances, they pray and ask for help only from Him. The people of ignorance remember to pray only when they are in a dire need. Otherwise, they ascribe partners to Allah and expect help from these partners. They will surely receive a painful treatment in return for this ignorance, both in this world and beyond.