One of the great Islamic scholars Ibn al Jawzi (may Allah have mercy upon him) discusses the trial of not having a supplication answered. The following is what he had to say regarding this issue:
“From amongst the trials that can befall a believer is to supplicate and receive no response, such that the believer repeats the du’aa’ for a long time and sees no sign of a response. It is upon the believer to realize that this is a test and requires patience.
What a person experiences from amongst the whisperings of the shaytan [when the response is delayed] is a sickness which needs medicine, I have experienced this myself.
A calamity befell me and I supplicated and did not see any response, and Iblees started to lay his traps. Sometimes he said : ‘The generosity (of Allah) is abundant and He is not miserly, so why is there a delay? ‘
I said to him: “Be gone, O cursed one, for I have no need of anyone to argue my case and I do not want you as a supporter! ”
Then I told myself: “Beware of going along with his whispers, for if there was no other reason for the delay except that Allah is testing you to see whether you will fight the enemy, that is sufficient wisdom. ”
My soul (nafs) said: “How could you explain the delay in the response of Allah to your prayers for relief from this calamity? ”
I said: “It is proven with evidence that Allah, is the Sovereign, and the Sovereign may withhold or give, so there is no point in objecting to Him.
2 – The wisdom behind that is proven in definitive evidence. I may think that something is good, but wisdom does not dictate it, but the reason for that may be hidden, just as a doctor may do things that appear outwardly to be harmful, intending some good purpose thereby. Perhaps this is something of that nature.
3 – There may be an interest to be served by delay, and haste may be harmful. The Prophet (peace and blessings of Allah be upon him) said: “A person will be fine so long as he does not become impatient and says, ‘I prayed but I did not receive any answer.’”
4 – The response may be withheld because of some fault in you. Perhaps there was something dubious in what you ate or your heart was heedless at the time when you said the du’aa’, or your punishment is being increased by means of your need being withheld, because of some sin from which you have not repented sincerely.
So look for some of these reasons, so that you might achieve your aim.
5 – You should examine the intention behind this request, because attaining it may lead to more sin, or prevent you from doing some good, so withholding it is better.
It was narrated that one of the salaf used to ask Allah to help him to go out on campaign, but a voice called out to him: ‘If you go out on campaign you will be taken prisoner, and if you are taken prisoner you will become a Christian! ‘
6 – Perhaps losing what you have missed out on will cause you to turn to Allah and getting it will distract you from Him. This is obvious, based on the fact that were it not for this calamity you would not have turned to Him, because the real calamity is what distracts you from Him, but what makes you stand before Him is good for you and is in your best interests.
If you ponder these things you will focus on what is more beneficial for you, such as correcting a mistake or seeking forgiveness or standing before Allah and beseeching Him, and forget about what you have missed out on . ”
Sayd al-Khatir (59-60).