THE PURPOSE OF LIFE
Everything in life has a purpose. Be it the pen that we use or the dress we wear, nothing has ever existed without a purpose! Allah (Glory be to Him), who is the All-Knower and All-Seer of all things, has created us and we too have some purpose, the purpose of existence.
If you ask anyone about the purpose of eating or why do we eat, everyone will say [in one word or another] that it is for nutritional purposes, because nutrition sustains life. If you ask anyone why they work, they will say because it's a necessity in order to support themselves and to provide for the needs of their families. If we ask anyone why they sleep, why they wash, why they dress, etc., they will answer with appropriate answers, for these are common necessities for all human beings. You can follow this line of questioning with a hundred questions and receive the same or similar answers from anyone in any language from any place in the world. You ask the question: Why, when you ask the question, "What is the goal and purpose of life?" that you may get many different answers? It is because people are confused; they don't really know. They are stumbling in the dark, and rather than say, "I don't know"; they just offer any answer they have been programmed to give. Think about it. Is our purpose in this world simply to eat, sleep, dress, work, acquire some material things and enjoy ourselves? Is this our purpose? Why are we born? What is the object of our existence? What is the wisdom behind the creation of man and this tremendous universe? 
Worship is the reason for which Allaah has created the creation. The Most High, said: “And I created the jinns and humans only to worship Me (alone). I do not seek any provision from them nor do I ask that they should feed Me. Verily, Allaah is the Provider of all, All-Power, the Most Strong.” [adh-Dhariyaat 51:56-58]
Allah has informed us that the wisdom behind creating the jinn and mankind is their establishment of the worship of Allah and He is not in need of their worship rather they are the ones who need it due to their poverty in front of Allah. So they worship Him in accordance with His shari‘ah. And whoever worships Him alone by that which he legislated is a believer, a muwahhid. 
Allah mentions to us in the Noble Quran (what means): "And to Allaah belongs the dominion of the heavens and the earth, and Allaah is over all things competent. Indeed, in the creation of the heavens and the earth and the alternation of the night and the day are signs for those of understanding. Who remember Allaah while standing or sitting or [lying] on their sides and give thought to the creation of the heavens and the earth, [saying], "Our Lord, You did not create this aimlessly; exalted are You [above such a thing]; then protect us from the punishment of the Fire.."[Quran 3: 189-191]
Now here in these ayah, Allah draws our attention to the creation of the heavens and earth, the alternation of the night and the day, the creation of the universe. He calls our attention to their creation and their precision, and mentions those who contemplate the wonders of creation and realize that this was not created for any foolish purpose, [that Allah is exalted above doing such a thing] and they seek refuge with Allah from the punishment of Hell. Truly, when you see the design of all that Allah created, you realize it is very powerful and very precise. Something very powerful and very precise; something beyond your own calculation and imagination, cannot be foolish. It cannot be just "thrown together". 
Life in this world is a test and only those who humble themselves enough to submit to their Creator and obey Him will pass the test. Qur’an says: “Does mankind think he will be left without any accountability?” Qur’an.Surah Qiyamah 75:36 
Muslims believe in an afterlife, the day when they would have to face the Allah (Glory be to Him) and be held accountable for all that they did in their lives. Those who overcome their desires and lived their lives in obedience to Allah (Glory be to Him) would be rewarded for their efforts and would earn Paradise whereas those who spent their lives in utter ignorance would be thrown to Hell.
Many people ask this question that why should we worship the Creator? The answer would simply be because: He is worthy of our veneration and worship and to Him belongs all ultimate perfection. So we should acknowledge this perfection as well as the bounties bestowed upon us by Allah (may He be exalted) such as : our eyesight, hearing, sense of smell, sense of taste, heartbeat and much more, that we have received them as gifts. The Quran tells us : “Whoever is guided is only guided for [the benefit of] his soul. And whoever errs only errs against it. And no bearer of burdens will bear the burden of another. And never would We punish until We sent a messenger.” Qur’an.Surah Isra 17:15