Praise be to Allah.
This question may be asked in two ways, either as an objection or as a quest for understanding. If it is asked as an objection, then it is an indication of the questioner’s ignorance. For the wisdom of Allah is too great for our minds to comprehend. Allah says (interpretation of the meaning):
“And they ask you (O Muhammad) concerning the Rooh (the spirit). Say: The Rooh (the spirit) is one of the things, the knowledge of which is only with my Lord. And of knowledge, you (mankind) have been given only a little”[al-Isra’ 17:85]
This spirit is something which is within us and is the very essence of our lives, but we do not know it and the philosophers and thinkers are unable to define and describe it. If we are unable to know anything about this spirit, which is the closest thing in creation to us, apart from that which has been described in the Qur’aan and Sunnah, then what do you think about other matters beyond that? Allah is Most Wise, Most Great, Most Majestic and Most Powerful, and we must submit to His will and decree with full submission, because we are unable to comprehend the ultimate goals of His wisdom. On this basis, the answer to the question is that we should say: Allah knows best and He is Most Wise, Most Powerful and Most Great.
If the question is asked as a quest for understanding, then we would tell this questioner: the believer is subjected to tests and Allah’s testing him by means of things that may harm or hurt him brings two great benefits. The first benefit is that Allah tests this man with regard to his faith, to see whether his faith is sincere or shaky. The believer whose faith is sincere will patiently accept the will and decree of Allah, and will seek reward from Him. In this case the matter becomes bearable for him. It was narrated that one of the female worshippers of Allah suffered a cut or wound in her finger, but she did not complain about the pain or show any sign of distress. She was asked about that and she said: The sweetness of its reward makes me forget the bitterness of bearing it. The believer seeks reward from Allah and submits to Him completely. This is one benefit.
With regard to the second benefit, Allah highly praises those who are patient and says that He is with them and that He will give them reward without measure. Patience is a high status which can only be attained by those who are tested with things that they bear patiently. If he bears them patiently, he attains this high status which brings great reward. So when Allah tests the believers with things that hurt them, that is so that they may attain the status of those who are patient. Hence the Messenger (peace and blessings of Allah be upon him), who was the greatest of all people in faith, piety and fear of Allah, suffered twice the pain of an ordinary man when he fell sick, and he (peace and blessings of Allah be upon him) suffered greatly at the time of death, so that he might fully attain the status of one who is patient, for he (peace and blessings of Allah be upon him) was the most patient of those who are patient. Hence the wisdom behind Allah’s testing of the believer with such calamities becomes clear.
With regard to His giving the sinners, evildoers, immoral people and kaafirs good health and plentiful provision, this is in order to let them get carried away (with their sin, and then punish them severely later on). It was narrated that the Prophet (peace and blessings of Allah be upon him) said: “This world is a prison for the believer and a paradise for the kaafir. They are given these good things so that they have their good things sooner, in this world, and on the Day of Resurrection they will get what they deserve of punishment. Allah says (interpretation of the meaning):
“On the Day when those who disbelieve (in the Oneness of Allah Islamic Monotheism) will be exposed to the Fire (it will be said): “You received your good things in the life of the world, and you took your pleasure therein. Now this Day you shall be recompensed with a torment of humiliation, because you were arrogant in the land without a right, and because you used to rebel against Allah’s Command (disobey Allah)” [al-Ahqaaf 46:20]
The point is that this world is for the kaafirs to get carried away in, then when they move to the Hereafter and leave the life of this world in which they found pleasure, they will encounter torment – we seek refuge with Allah. The punishment will be so much harder for them because they will suffer greatly, and because at the same time they will have lost the delights and luxuries of this world which they loved so much.
There is a third benefit which we may add to the first two, which the believer will get from sickness and problems, for the believer will move to a realm that is better than this world, for he will move from something that hurts him and causes him pain to something that will bring him happiness and joy. So his joy at the delight to which he has come will be multiplied, because he has attained joy, and the pain and difficulties that he was facing will have ceased.