The Vedic period and the formation of caste
From the cattle-herding tribes of Punjab to the settled kingdoms of the Ganges plain, the Vedic hymns, together with the priestly class, shaped a caste order that would endure for several thousand years.
Aryans enter the Punjab

Indo-European-speaking Aryan tribes gradually moved into the Punjab region of the upper Indus (some say by a roundabout route through Central Asia), bringing horses, chariots and a pastoral way of life in which cattle were the core form of wealth. The Rigveda, with its hymns praising the gods and its sacrificial rituals, was gradually composed during this period through oral transmission.
Eastward expansion into the Ganges plain

The spread of iron tools made it possible to clear the densely forested Ganges plain, and Aryan tribes gradually migrated east and settled there, forming early tribal kingdoms. During this period Vedic sacrificial rites also grew increasingly elaborate, and the status of the Brahmin class, which specialized in sacrifice, rose accordingly.
The Purusha Sukta and the four varnas

The Purusha Sukta of the Rigveda describes a cosmic giant transformed into four classes: from his mouth came the Brahmins, from his arms the Kshatriyas, from his thighs the Vaishyas and from his feet the Shudras. This metaphorical description of the social division of labor gradually hardened into the varna hierarchy, hereditary and impossible to cross.
Kingdoms and the Upanishads

Tribal kingdoms such as the Kuru rose one after another on the upper Ganges, and the power struggle between the priestly and warrior classes grew increasingly complex. At the same time, a body of philosophical texts reflecting on the relationship between "Brahman" and "Atman," the Upanishads, appeared one after another, turning Vedic religion from ritual toward introspective metaphysical inquiry.
The sixteen great states and re-urbanization

Sixteen larger "states" formed in succession in the Ganges basin, urban life revived, and money and long-distance trade recovered along with it. The relatively loose social division of labor was further subdivided at this stage into countless small hereditary occupational groups called "jati," laying the basic framework of the later caste system.