Allah, Glorious is He, created the heavens and the earth and created life and death. He adorned the earth with what it contains in order to try His servants and examine them so that He could know those who desire what lies with Him as opposed to those who desire this world and its possessions.
“It is He Who created the heavens and the earth in six days when His Throne was on water, in order to test which of you has the best deeds.” (Hud 11:7)
“We made everything on the earth adornment for it so that We could test them to see what deeds are best.” (al-Kahf 18:7)
“He who created death and life to test which of you is best in deed.” (al-Mulk 67:2)
“We test you with both good and evil as a trial; and you will be returned to Us.” (al-Anbiya 21:35)
“We will test you until We know the true fighters among you and those who are steadfast and test what is reported of you.” (Muhammad 47:31)
“Alif Lam Mim. Do people think that they will be left to say, ‘We believe and will not be tested? We tested those before them so that Allah would know the truthful and who know the liars.” (al-Ankabut 29:1-3)
When Messengers are sent to them, people fall into one of two categories – believer and disbeliever, both are tried. As for the believer, he will necessarily undergo trial and tribulation so that is becomes clear as to whether he is truthful in his claim or not. If he is not truthful, he will turn on his heels and flee from tribulation. If he is truthful, he will remain firm and the tribulation will serve to increase him in faith. Allah, Exalted is he, says,
“When the believers saw the confederates they said, ‘This is what Allah and His Messenger promised us. Allah and His Messenger told us the truth.’ It only increased them in faith and submission.” (al-Ahzab 33:22)
As for the believer, he will be tried in the Hereafter with the punishment. Everyone will face tribulation in this life, in the Barzakh and on the Day of Judgement; however the tribulation faced by the believer is relatively less than that of the disbeliever. Allah allows the believer to bear the tribulation by virtue of his faith and nourishes him with sabr, firmness (thabat), rida and acceptance such as would lighten the burden of tribulation. As for the disbeliever, the hypocrite and sinner, tribulation weighs down heavily on them and stretches on. Therefore the tribulation faced by the believer is light and short whereas the tribulation faced by the disbeliever is burdensome and prolonged.
Trials and Tribulations: Wisdom and Benefits (Note that this extract is taken from Aid for the Yearning One in Resisting Shaytan) Imam ibn Qayyim al-Jawziyyah Pages 48-51