The word "hijab" or "ḥijāb"  refers to both the head covering traditionally worn by Muslim women and modest Muslim styles of dress in general

The Qur'an instructs both Muslim men and women to dress in a modest way.
The clearest verse on the requirement of the hijab is surah 24:30–31, asking women to draw their khimār over their bosoms.
And say to the believing women that they should lower their gaze and guard their modesty; that they should not display their beauty and ornaments except what (must ordinarily) appear thereof; that they should draw their khimār over their bosoms and not display their beauty except to [...] (Qur'an 24:31)
In the following verse, Muslim women are asked to draw their jilbab over them (when they go out), as a measure to distinguish themselves from others, so that they are not harassed. Surah 33:59 reads:
Those who harass believing men and believing women undeservedly, bear (on themselves) a calumny and a grievous sin. O Prophet! Enjoin your wives, your daughters, and the wives of true believers that they should cast their outer garments over their persons (when abroad): That is most convenient, that they may be distinguished and not be harassed. [...] (Qur'an 33:58–59)

The hijab is a relatively new phenomenon in Indonesia. Even before Western influence, most Indonesian women (especially Javanese) rarely covered their hair except when praying, and even then the hair was only loosely covered by a transparent cloth. Young females may also elect to wear the hijab publicly to avoid unwanted low-class male attention and molestation and thus display their respectability as "good Muslim girls": that is, they are not "easy" conquests

The sole exception where jilbab is mandatory is in Aceh Province. This Acehnese Hukum Syariahand the reputedly over-bearing "Morality Police" who enforce its (Aceh-only) mandatory public wearing are the subject of fierce debate.