In the Qur'an the term hijab refers to a partition or curtain in the literal or metaphorical sense. The verse where it is used literally is commonly understood to refer to the curtain separating visitors to Muhammad's house from his wives' lodgings. This had led some to argue that the mandate of the Qur'an to wear hijab applied to the wives of Muhammad, and not women generally.
In recent times, wearing hijab in public has been required by law in Iran, Saudi Arabia and the Indonesian province of Aceh. Other countries have passed laws banning some or all types of hijab in public or in certain types of locales. Women in different parts of the world have also experienced unofficial pressure to wear or not wear hijab in general, or in its certain forms, including physical attacks.
The Quran instructs both Muslim men and women to dress in a modest way, but there is disagreement on how these instructions should be interpreted. The verses relating to dress use the terms khimār (head cover) and jilbāb (a dress or cloak) rather than ḥijāb.
The clearest verse on the requirement of modest dress 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 breasts and not display their beauty except to their husband, their fathers, their husband's fathers, their sons, their husbands' sons, their brothers or their brothers' sons, or their sisters' sons, or their (Muslim) women, or the slaves whom their right hands possess, or male servants free of physical needs, or small children who have no sense of the shame of sex; and that they should not strike their feet in order to draw attention to their hidden ornaments.
In Surah 33:59 Muhammad is commanded to ask his family members and other Muslim women to wear outer garments when they go out, so that they are not harassed
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.