The caste system in India began about 100 B.C. when a holy text explicitly forbade intermarriages across the four classes of people living in India at the time. Occupational restrictions and forbidden intermarriages, which curtailed further social interactions, hardened the caste system.
For centuries, ancestral North Indians and ancestral South Indians lived side-by-side without intermarrying. About 4,000 years ago, the fall of the Indus Valley civilization caused huge migrations across North India. As the population increased and social conventions changed, the two ancestral groups intermarried and produced social classes. Although there were distinct classes of people -- the common people, the nobility and the priests -- there were no occupational or social restrictions. After the fourth, lowest class emerged, the Manusmuruti, which was a holy text, forbade further intermarriages across these classes.
From the turn of the second millennium, Indian society began avoiding intermarriages and close relationships between different ethnic groups. These social restrictions ultimately led to the creation of the caste system. Some ancient texts suggest that the division of the Indian society occurred as a result of the creation of four groups of people from the four heads and four hands of Brahma -- the Indian deity regarded as the creator of the universe.