The āśrama system is bed on the idea of hermits / ṛṣīs living in an āśrama (= hermitage for spiritual practice) after giving up the aims of everyday life.
In the Dharma Śūtras, it was initially taught that one could choose any of these paths of life (householder, forest dweller, or renouncer) after one had completed one’s education. Eventually, these different options became organized as different stages of life.