They were introduced over 800 years ago at the time of the conflicts against the Mughal empire (Persian) that was widely expanded among the Indian territories. The turbans therefore served in combat as head protection. The people of Rajasthan, called Thakurs dress a kind of turban called Peta (what you see in the picture). This is, for example, different from the one dressed by the people of Punjab, believers of the Sikh religion.
Nowadays there are several types of turbans with different colors and shapes, but are used as a fashion rather than protection, and are normally only men to dress them.