Hijāb actually is an Arabic word which means to cover or conceal, not the headscarf worn on heads. It's commanded in The Qur'an for believing women to conceal themselves around non-mahram men (I.e any man who is not your husband, brother, father, grandfathers, son, nephew, father in law, son in law and a few others). Many people will probably get hurt at this but a lone headscarf on the head is not an actual hijāb, since the whole body must be covered with untight clothing.
"O Prophet! Tell your wives and your daughters and the women of the believers to draw their Jalabībīn (Plural of Jilbāb) all over their bodies (i.e.screen themselves completely except the eyes or one eye to see the way). That will be better, that they should be known (as free respectable women) so as not to be annoyed. And Allah is Ever Oft*-Forgiving, Most Merciful." [Qur'an 33:59]
"And enjoin believing women to cast down their looks and guard their private parts and not reveal their adornment except that which is revealed of itself (i.e face/eyes and hands) and to draw their veils over their bosoms, and not to reveal their adornment (i.e hide their beauty)" [Qur'an 24:31]
Narrated Safiya bint Shaiba:
“Aisha used to say: "When (the Verse): "They should draw their veils over their necks and bosoms," was revealed, (the ladies) cut their waist sheets at the edges and covered their heads and faces with those cut pieces of cloth." [Sahīh Al-Bukhari 4759]
They wear it for the main reason of modesty and to show that their beauty holds value so is not for everyone to see. I'd like to also add that hijāb is obligatory for men too, however our awrah (Part of the body that should be covered) is different so we only have to cover Navel to Knees.