Worshiping God is not mandatory. But one who wants true happiness (which actually all do), can only obtain it by approaching and surrendering to God. But because God is both with and without attributes one can chose the path of worship and serving God or the path of meditating upon His formless aspect or only continue to do actions in a detached way without worshiping God. However, the path of devotion is the easiest, safest and quickest way of deliverance from this materialistic mode of existence filled with dualities like pain-pleasure, happiness-distress, birth-death, etc. It is because, in other paths, the jiva walks on his own power and hence must deliver himself through his own effort. But in the path of devotion, God delivers his surrendered devotees:
But those who worship Me, giving up all their activities unto Me and being devoted to Me without deviation, engaged in devotional service and always meditating upon Me, having ﬁxed their minds upon Me, O son of Pṛthā – for them I am the swift deliverer from the ocean of birth and death. [BG - 12.6,7]
Since many users are taking interest in this question and the title has changed since the time I originally wrote the answer, I am improving and explaining the original brief answer a bit more clearly.
Is the ultimate purpose of life only to serve God?
No, serving God is not the ultimate purpose of life; at least not per Hinduism. The ultimate purpose of life is happiness, peace, bliss or whatever other name you give it. Why? Because serving or worshiping God is something that a person comes to know about much later in life. But seeking happiness or avoiding pain is something that a person (jiva) knows inherently starting from his birth without even anyone teaching him it explicitly. Because it is happiness that a person ever wants, getting true happiness that is eternal and everlasting is the ultimate purpose of life. Anything that a person does, is only a mean to that end.
So in Hindu or Vedic schools of thought avoidance of suffering (dukha) and obtaining of bliss (ananda) has been accepted as the purpose of life. Now the question is, if happiness is the purpose of life where does God come from into the picture?
Happiness and God
In Hinduism real happiness is defined as something which is infinite. That is, it doesn't wane away or taken over by distress and problems. But the happiness that we generally get from the world and its objects are momentary and temporary being under the influence of time. Driven by never satiating desire, a person will have to work again and again at the cost of disappointment and distress to maintain such temporary happiness. But the sages and saints who have realized God have experienced God as the ultimate everlasting bliss. So the scriptures say, God is nothing but bliss, or bliss itself is God (i.e. God and bliss are synonyms). And by attaining that bliss that once can become blissful:
anando brahmeti vyajānāt [Tait. Up - 3.6]
- Brahman (God) is bliss, thus I (Brhigu) realized.
raso vai saḥ , rasa hyevāyaṃ labdhvā ānandī bhabati [Tait. Up - 2.7]
- He is the sweet mellow. Obtaining this mellow one becomes blissful.
So God being eternal and beyond the effects of time, unlike the material happiness, any happiness that will be derived from Him will be eternal. Because happiness is the objective of life and God is the ultimate happiness that there is, scriptures suggest to approach and attain God :
O scion of Bharata, surrender unto Him utterly. By His grace you will attain transcendental peace and the supreme and eternal abode.[BG - 18.62]
So, not because God is our creator or master that we need to approach God, but because knowingly or unknowingly it is the ever lasting happiness of God that we are looking for, we are told to attain God. Because until and unless that happiness is obtained, a jiva will be doing various kinds of activities for it (both sins and good deeds, but mostly sins due to ignorance and illusion) and will be suffering their reactions in various kinds of bodies in this materialistic mode of existence.
Is serving God the only path in Hinduism to unite with God?
No, there are other paths too. Some schools of thought like Samkhya and Nyaya say a person needs to acquire the right knowledge to eradicate ignorance and thus he will be able to avoid suffering, because suffering (dukha) is caused by ignorance only. But it is not always guaranteed that just by avoiding suffering one will become happy (e.g. sleep state). So Vedanta school of thought says by attaining God or bliss that the objective will be fulfilled. So for the purpose of attaining or uniting with God three different paths have been laid out in scriptures for people of different ability, state and situations:
1. Karma Marga (path of detached action)
This is the path of just doing good without any attachment to the work and its results. In this path there is no worship of God is required.
2. Bhakti Marga (path of faith or devotion)
This is the path where worshipping and serving God mentally and physically is required. Here God is worshipped with form and attributes. The devotee surrenders to God leaving every kind of dharma and always remembers and practices His devotion. So God gives him liberation from the sins of leaving other actions (BG - 18.66).
2. Jnana Marga (path of knowledge)
This is the path of realizing oneself to be the Brahma himself (aham brahmasmi). Here the nirguna nirakara (attribute less and formless) aspect of Brahma is meditated upon. There is no worship or serving of God in this path.
But among these three paths, Jnana Marga is too difficult and Karma Marga is too lengthy. Because it may take quite a number of births until one's actions and reactions get balanced out so that he will not born again. Also there are chances of failing from the path in the above two. So the path of devotion is the easiest and safest for most people in this age of Kali, so it is mostly suggested by saints and sages. But the thing is, all paths are cyclically related, so irrespective of from where one starts, if he follows that sincerely he will get the results of the next. And at some point or later a jiva has to practice devotion because only through God's grace that one can get rid of maya (illusion).
Are we all meant to do is worship God?
No, we are not meant to serve God by default. That is, it's not mandatory or compulsory. Jiva (a being) is independent and hence free do to whatever he likes. But whatever a jiva will do, he will do it only for the purpose of getting happiness. So by understanding where true happiness exists, a jiva has to do the decision and choice for himself. It's always the choice of the jiva whether to approach God and get real happiness or revolve in this materialistic mode of existence attaching his mind to temporary happiness and suffering distress and disappointment on its way.
Because it is always the choice of the jiva, even after Krishna (an incarnation of God in Hinduism) explained everything to Arjuna, He didn't tell him to do whatever He said just because He was God. He told Arjuna to think over all the instructions and do as he liked:
iti te jñānam ākhyātaṁ guhyād guhya-taraṁ mayā
vimṛśyaitad aśeṣeṇa yathecchasi tathā kuru [BG - 18.63]
Thus I have explained to you knowledge more conﬁdential than the conﬁdential. Deliberate on this fully, and then do what you wish to do.
So says the Katha Upanishad (2.2) in a similar context that, both material happiness (preya) and spiritual happiness (sreya) approach a person, the wise is he who chooses the later.