Muslims believe in the one and only Creator Allah. He is the only One worthy of worship and has indeed created us for a purpose. He has sent many Messengers and Prophets to guide humanity to the straight path, with Muhammad (pbuh) being the Final Messenger and the Quran being the Final Revelation where Allah clearly defined the Purpose of Life.
Allah says in the Quran that we were indeed created for a purpose beyond that of mere play and enjoyment.
“Did you think that We created you uselessly and that to Us you would not be returned?” – Quran 23:115
Allah states that the reality of this life is one of deception and we should not fall for its temporary enjoyments.
“Know that the life of this world is but amusement and diversion and adornment and boasting to one another and competition in increase of wealth and children – like the example of a rain whose [resulting] plant growth pleases the tillers; then it dries and you see it turned yellow; then it becomes [scattered] debris. And in the Hereafter is severe punishment and forgiveness from Allah and approval. And what is the worldly life except the enjoyment of delusion.” – Quran 57:20
Allah assures us that the reality of this life is that each and everyone of us is being tested, and we will be brought back to our Lord in account for every deed we have performed, both the good and the bad. Based on that, we will either be rewarded an eternal life of joy in Heaven or be punished in Hell.
“[He] who created death and life to test you [as to] which of you is best in deed – and He is the Exalted in Might, the Forgiving.” – Quran 67:2
Allah also teaches us that the purpose of life is to also worship Him alone without associating partners with Him. This does not necessarily mean praying 24 hours a day with our face planted on the ground, but rather living our lives in obedience to God in accordance with the moral code outlined in the Qur’an. This includes being kind to our parents, relatives, neighbours, the poor and the needy. It also means fulfilling the commands of God whether it is to perform the 5 daily prayers, pay the Zakat (Charity), fast the month of Ramadan and perform the Hajj (Pilgrimage).
“And I did not create the jinn and mankind except to worship Me.” – Quran 51:56
The Purpose of Life is also stated in the Bible in a similar manner.
“The conclusion of the matter, everything having been heard, is: Fear the true God and keep his commandments, for this is the whole obligation of man. For the true God will judge every deed, including every hidden thing, as to whether it is good or bad.” – Ecclesiastes 12:14-15
For a clear perception about life please read – What is Life?