Praise be to Allah.
The believing woman is enjoined to wear hijab. We have discussed hijab on this site in the answer to more than one question, and these answers tackle the matter from different angles. Some of them focus on the ruling on hijab and point out that it is obligatory, as in the answer to question no. 21536. Some quote the definitive evidence for hijab being obligatory, such as the answer to question no. 13998 and 11774. Some describe the shar’i hijab, such as the answer to question no. 6991. Other answers speak of the importance of hijab in the life of the believing woman.
If a woman does not wear hijab, then she is disobeying her Lord thereby, but her fast is still valid, because sins, including not wearing hijab, do not invalidate the fast, but they detract from its reward, and may cause it to be lost altogether.
What we urge you to do is wear hijab as well as fast, because the aim of fasting is not merely to give up food and drink, rather the aim is to fast or abstain from haraam things. Hence the Prophet (peace and blessings of Allaah be upon him) said: “Fasting is not just (abstention) from food and drink, rather fasting is (abstention) from idle and obscene talk.” Narrated by al-Haakim and classed as saheeh by al-Albaani in Saheeh al-Jaami’ (5376).
Idle speech refers to that in which there is no benefit.
So let your fasting motivate you to obey Allaah and keep away from that which He has forbidden.
We ask Allaah to help you to do that which He loves and which pleases Him.
And Allaah knows best.