Varna system is root of Indian caste system. Varna System started since 3000-4000 years ago. The first reference to varna comes in Rig Veda.
Veda and other Hindu literature classified the society into four principle varnas:
The Brahman: priests, academics, scholars and teachers.
The Kshatriya: rulers, warriors,kings and administrators.
The Vaishya: cattle herders, agriculturists, artisans, landowners and merchants.
The Shudra: workers, servants, commoners and peasants.
According to legends, the Purusha Sukta explains origin of the four varnas from Lord Brhama. Varnas appears as
Brahmins from the Head,
Kshatriya from the arm
Vaishya from Thighs
Shudra from the feet of the Purusha.
But during vedic time, Varnas are not based on birth. People are free to choose their varna and marriage is also allowed.