Hazrat Umar once lashed a slave girl with a whip and said to her, “القی عنك الخمار، أتشبھین بالحرائر یادفار”. However, in the end, she is only a woman. The Holy Prophet S.A was very strict regarding the Hijab, and he even took a cloth and covered a disbelieving woman. So, how could this statement be ascribed to someone such as Hazrat Umar?
A slave girl is not obligated by the Shari’ah to wear the Hijab. In those days, there was a specific code of dress from which slaves were identified. Since the slave girl violated this code of dress, which made her resemble the free women, Hazrat Umar (R.A) had reprimanded her for it. Moreover, the disbelieving woman whom the Holy Prophet had covered with a cloth, was a free woman.
And Allah knows best.