What and when is the origin of the Hijab?
The Prophet Muhammad wanted to segregate the women from the men. Also, he wanted to help the women to wear a hijab so they won't be recognized in the streets, and no harm would come to them.
The above answer gives the (wrong) impression that Prophet Muhammad (peace be upon him) wanted on his own to introduce hijab. The fact is that he was ordered by Allah as per following quotation from The Noble Qur'an - Al-Ahzab 33:59
"O Prophet! Tell your wives and your daughters and the women of the believers to wear over them "jalabeebs". That will be better, that they should be known (as free respectable women) so as not to be annoyed. And Allaah is Ever Oft-Forgiving, Most Merciful. "
The interpretation of jalabeeb can be given only by a person who is well versed with Arabic language, and the customs of Arabs in those days when the order came from Allah. May be jalabeeb was worn to distinguish the Muslim women from non-Muslims as the latter went around showing themselves without any hijab.
I invite some Arab scholar to kindly elaborate on jalabeeb. Jazak Allah Khair, (May Allah reward you with good)