Varna is for the body, ashrama is for the soul
The varnas are, so to speak, classifications of different occupations, and ashrama-dharma is gradual progress on the path of self-realization. Both are interrelated, and one is dependent on the other.
Srimad Bhagavatam 1.9.26 purport