Like all other Indian festivals, Raksha Bandhan too has a long historical background. The history of Raksha Bandhan goes back to the early days of the arrival of the Aryans in India. The Aryans performed Yajnas before going to wars. This was done to invoke blessings of the God. Before the men departed for the battlefield, their womenfolk tied sacred threads or amulets to protect them and also to remind them of their duties to uphold the honor of their tribe. This is how the custom of Raksha Bandhan seems to have originated.
It is said that when Alexander invaded India in 326 B.C., his wife tied a Rakhi to the king Porus. In return Porus is believed to have promised to protect her and her husband. In the medieval period, we have numerous examples of the practice of tying knots or threads. The history of Rajputana is full of several such examples of Rakhi like traditions. The most famous of them is the story of the Queen karnavati of Chittor, who sent a Rakhi to the Mughal emperor, Humayun to save her kingdom from the invasion of Bahadur Shah of Gujarat. That particular day of Purnima was celebrated as Raksha Bandhan in Marwar and then all over Rajasthan and, finally, throughout India.
Slowly and gradually the concept of tying knots or threads spread to other parts of India and assumed broader significance. The most recent historical example of Raksha Bandhan comes from India's struggle for freedom. To oppose the partition of Bengal, the great poet Ravindranath Tagore organized Raksha Bandhan to promote brotherhood and solidarity between Hindus and Muslims. Besides, there are numerous legends related to Raksha Bandhan in the Hindu mythology.
This page on the history of Rakhi traces the history and origin of Raksha Bandhan festival and Rakhi. The history and origin of Rakhi is full of many interesting legends.
Rakhi Festival : History of Rakhi