1- a warning for wrongdoings.
2- cleanses our sins.
3- shows our weakness.
4- make us closer to God.
this life is a test. The Qur’an states:
Allah has created death and life to test which one of you is best in deeds.
To each of you We have ordained a code of law and a way of life. If Allah had willed, He would have made you one community, but His Will is to test you with what He has given you. So compete with one another in doing good. To Allah you will all return.
Our presence in this earth as a Human being is a test for us from God. God declared in the Quran that He would test us with difficulties and also with good fortunes. When we face difficulties, our test is whether we stay patient, we persevere and pray to God for help. We are here on Earth for a reason, to carry out good deeds and worship the creator God. The World is the test centre where we are being examined but the result we will know later. We humans want to see God, yet can not stare at the Sun for more than a few seconds.
And We will surely test you with something of fear and hunger and a loss of wealth and lives and fruits, but give good tidings to the patient, Who, when disaster strikes them, say, ‘Indeed we belong to Allah, and indeed to Him we will return.’
Alif, Lam, Meem. do people think that they will be left to say, “We believe,” without being tested? We certainly tested those before them. And Allah will clearly distinguish between those who are truthful and those who are liars. Do those who do evil imagine that they will escape Us? How ill they judge! Whoever looks forward to the meeting with Allah — the appointed time of Allah is coming. He is the All-Hearing, the All-Knowing. Whoever strives, strives only for himself. Indeed, Allah is free from need of the worlds. As for those who believe and do good, We will certainly absolve them of their sins, and reward them according to the best of what they used to do.
the essential purpose for which humankind was created is the worship of God. God states that He made this life in order to test man so that every person may be recompensed after death for what he has earned.
You will certainly be put to test in respect of your properties and lives, and you will certainly hear many hurtful things from those who were given the Scripture before you and from the polytheists.
— Quran 3:186
Are you pleased with the life of this world instead of the Hereafter? Yet the enjoyment of the life of this world, compared with the Hereafter, is but a little.
The life of this world is just like rain We send down from the sky, producing a mixture of plants which humans and animals consume. Then just as the earth looks its best, perfectly beautified, and its people think they have full control over it, there comes to it Our command by night or by day, so We mow it down as if it never flourished yesterday! This is how We make the signs clear for people who reflect. And Allah invites to the Home of Peace and guides whoever He wills to the Straight Path.
this life is only one brief stage on its journey from God to God. And our Lord informs us repeatedly that our temporary life on this earth is merely a trial, a test, an examination period.