For it is a command of Allah (SWT) for women to wear headscarf, a woman becomes responsible by quitting an obligatory act if she does not wear a headscarf. On the other hand, by performing stated prayers, she becomes free from its responsibility and gets its merit.
On the other hand, as the verse things that are good remove those that are evil (Hud Surah, 11:114) points out, stated prayers and similar acts of worship, and good deeds cause man to be forgiven of the sins he has committed. Besides, it is a reality that stated prayers keep man away from evil. The verse points to this fact as follows: Surely, the Prayer restrains from all that is indecent and shameful, and all that is evil. (Al-Ankabut Surah, 29:45) However, it cannot be said that worship will immediately keep man away from every kind of evil. In the course of time, as a wonder and fertility of stated prayer, many people cannot get involved in sins and they keep away from them. Because, someone who five times a day comes before the presence of Allah (SWT) in a humble position by taking ablution cannot do the things that his Lord has prohibited.