To be alive necessitates that one wishes to continue to be alive and that wish inevitably leads to the pursuit of survival amongst organisms. The desire to be alive also trumps other considerations such as procreation. Children and the elderly lack the ability to reproduce but still value their lives and wish to live on, which is indicative that survival and extending one's life is the purpose of life. Non-living organisms are different from those who are living because their existence is passive - rocks, for instance, get eroded and are entirely at the mercy of the elements. On the other hand, the living exert a greater degree of control of the elements in order to maximise their chances of survival and extend their lives. Animals and humans build shelters to protect them from the elements as a sign of the inherent desire to survive. Living organisms can react to, and sometimes control, their environment. In the 3.5 billion year history of the Earth, life evolves to more complex forms in response to various environmental changes. The success with which a species can adapt and evolve determines their survival. Although survival may mostly be due to a randomised process of natural selection, the purpose of life remains the same as species aim to survive long enough for favourable genetic changes to take place in their evolutionary train. 
The increase in the complexity of life forms on Earth with the passing of time is actually indicative of the shift away from primal existence determined solely but instinct towards a more fulfilling life where the pursuit of knowledge and understanding of the mysteries of the world can be achieved.  With the passing of time and increasing complexity of life forms, humans have become the most advanced creatures. We have increased the tools at our disposal to satisfy our innate human curiosity, and given that there are more mysteries in our universe than we can ever unravel, the never-ending journey to satisfy our curiosity through advances in science, for example, is the purpose of life.
The ability to adapt to changing environments is driven by a desire to preserve and extend the lifespans of organisms.