The four goals of human existence are called purushartha and consist of dharma, artha, kama, and moksha. Here what does it mean to attain dharma as a goal? Why is dharma considered to be a goal?
Srimad Bhagavata Purana explains why kama and artha cannot be the ultimate goals of man. Dharma as a goal means one has to understand that kama and artha are not ultimate goals. A person living in accordance with Dharma has the opportunity to attain moksha, the ultimate goal of life. It is in this sense that Dharma is considered as a goal.
Strictly speaking Dharma is a goal for a householder. He is given this goal as otherwise he will strive recklessly for the fulfillment of kama and artha.
Dharma, understood as the Supreme Good of man, can never have wealth as its reward. Nor has wealth, understood as an aid to the achievement of Dharma, been conceived as an aid for the attainment of kama (sexual desire). Kama in its turn is not a call to indulgence in sexual pleasures, but a mere inducement implanted by the Creator to make life unbroken. And as for life, it has the quest of the Supreme Truth as its end – not certainly Karma (i.e. performance of rituals and social duties) for the attainment of wealth (prosperity here and heaven hereafter).
Srimad Bhagavata Purana I.2.9-10