Sage Patanjali is the author of the Yogasutra, the principles of yogasana and yoga sadhana.
There a number of legends about who Sage Patanjali was, which era did he live in, and what inspired him to present the different domains of knowledge, that have been attributed to his pen.
The fact relevant here is that he summarised the most important and significant knowledge about Yogashastra (the science of yoga) and Yogadarshana (one of the six fundamental streams of Indian philosophy) into the Yogasutra, a collection of 196 aphorisms or Sutra's.
Background of Indian theological thought.
Vedic theological thought is centred on a Supreme Being. There are different ways of referring or describing this Supreme Being, as the universal soul, as the Infinite being, and so on. But, the only ultimate objective that a human being can have - in Vedic thought - is to "find" or "realise" or "merge" with this Supreme Being. This process is described as योग i.e. yoga (the trailing sound of "a" is not pronounced) translated as union or merger.
There are six primary schools of philosophy that evolved from the Vedic heritage. They are called दर्शन - darshana's. Formally - षाड दर्षन - shaad darshana. One of these six is called Yogadarshana - योगदर्शन. A key element of the body of vedic and philosophical scriptural literature is that there are many paths described for achieving योग - yoga i.e. merger - with the Infinite or Supreme Being. Hence, one would hear of Bhaktiyoga, Gnanayoga, Karmayoga and so forth. All these paths recognise that a human being needs to achieve a progressively higher state of the mind, with an ever expanding intellect and sharper focus, to finally "see" or "realise" the Supreme Being. How else would a human being even recognise that he or she has "found" the Infinite. To achieve these states of the mind, the human body had to be readied to allow the mind to advance. This preparation was through Yogasana, योगासन and the processes were described under a collective identity called Yogashashtra योगशास्त्र or the science of Yoga.
On yogasana and the yogasutra's.
Legend has it that that Lord Shiva, gave the knowledge of the asana's to a sage, (there are contentious issues about who that sage was) who then organised that knowledge into a collection known subsequently as Hathayoga. Hathayoga contains the mechanics of the asana's and other aspects.
Sage Patanjali wrote a commentary on Yogashastra, and then summarised the fundamental aspects of it as a collection of instructions on how to proceed through eight stages of progress towards the ultimate goal of yoga or union with the Infinite! Hence, the word Astangayoga - which is often called - inappropriately - as one more type of yoga. The sutra's lay out the guiding principles on how to perform the asana's so that they truly prepare the body and mind for progress through to the advanced stages.
The eight stages or houses, are Yama, Niyama, Asana, Pranayama, Pratyahara, Dharana, Dhyana, Samadhi. Most of human kind is still struggling with the first four - often at very preliminary levels and often, in cursory ways. Most of us struggle with the Yama and Niyama - i.e. universal morality and discipline (of life), and jump into Asana and sometimes Pranayama as if they were a form of exercise or calisthenics.
Some fundamental elements of Yama and Niyama are necessary to be able to grasp the intense awareness and sensitivity to our own bodies and minds, to be able to learn the asana's deeply, and prepare the mind and body for Pranayama and onwards. Even as a non-spiritual life activity, the first four stages will yield great benefit! A calm enlivened healthy mind creates a healthy wholesome body as well!