Does life have a purpose?
Let's begin by clarifying what's being asked. The question isn't whether people can lead purposeful lives. Of course they can, if they are sufficiently fortunate. Anyone who has enough to eat, who lives in a society that tolerates a modicum of personal freedom, who has educational and employment opportunities, who is not condemned to a life of soul-destroying labor, and so on, is in a position to lead a purposeful life. That's a no-brainer.
The question on the table is much deeper than this. It is about whether life itself has a purpose. To answer it, we need to consider the conditions under which anything at all has a purpose, and then determine whether life can satisfy these conditions.
There are two and only two kinds of purposes. One kind of purpose is biological. When we say that the purpose of the eye is to see, we are talking about its biological purpose. Although philosophers have theorized about the nature of biological purposes since at least the time of Aristotle, it was Charles Darwin who discovered the conditions under which such purposes arise. Biological purposes are products of evolution. Put crudely, the biological purpose of a thing is whatever things of that kind were naturally selected to do: Eyes have the purpose of seeing because seeing enhanced the reproductive success of animals with eyes, which caused eyes to proliferate down the generations.
Could life have a biological purpose?
No, it couldn't.
Biological purposes are products of evolution. So, for life to have a biological purpose, it would have to be a product of evolution. But life isn't a product of evolution. For evolution to occur, life has to be on the scene already. Evolution presupposes life, and that's why it can't be the case that life has a biological purpose.
The other kind of purpose is instrumental. When we say that hammers have the purpose of driving in nails, we are talking about their instrumental purpose. This sort of purpose comes from the intentions of a thing's creator. The purpose of a hammer is to drive in nails because that's what the hammer's creator had in mind when he or she designed it.
Could it be that life has an instrumental purpose? More explicitly, could it be that life had a creator, and the purpose of life is what the creator had in mind when he (she?) created it?
This position has obvious attractions for religiously-minded people. It's easy for atheists to become impatient with this approach, and to claim that God doesn't exist and that life is devoid of purpose. However, this would invite the retort that God does exist, and result in a well-worn sequence of fruitless assertions and counter-assertions concerning God's existence. So, let's start from a different position—a position that theists can wholeheartedly accept. Let's suppose, for the sake of the argument, that God does exist, and that he imbued his creations with purposes.
Now, if this is the case, does it make sense to claim that the purpose of life is whatever God had in mind when he created it?
No, it doesn't. Even if God exists, it can't be the case that life has a purpose. Here's why.
A god who performs acts of creation is an agent, and to be an agent one must, minimally, be alive. So, if God exists, he must be a living god (unsurprisingly, he is described as such in the scriptures of Judaism, Christianity, and Islam). But if God is a living god, then we are confronted with the same kind of problem that we encountered when asking whether life has a biological purpose. God can't have created life, because God must already be alive in order to create anything at all. As it's conceptually impossible that God created life, it's impossible that he created life with a purpose in mind
It can't be that life has a biological purpose, and it can't be that it has an instrumental purpose. Because these are the only two options, it can't be that life has a purpose.