Technically I think polity probably is closer to being correct here, because the regime is a politically organized unit; the regime is not a course of action or an overall plan.
However, neither word looks very good here because of the way the sentence is structured and because of the way in which we usually use the word polity. Polity is a rather specialized word that usually means something like "something that is a single entity within the context of politics." Some examples,
The polity is here conceived of as the highest order sociopolitical unit in the region in question. (In other words, "The 'polity' I'm talking about here is the largest-scale political structure in the area."
The people of a polity might reasonably wonder about the control they have over the historical drift and flux of their culture.
(In other words, "The people who make up a political unit might wonder about the control they have..."
It is the search for attitudes and beliefs among the landowners who dominated the medieval polity... (In other words, "among the landowners who dominated the politics of the body of the people".)
So it doesn't really make sense to say "the republican and secular regimes are the new polity". Polity doesn't mean "a regime"; it means something more like "the whole political structure of the country" or "all the people, considered as a political entity".
If I had to rewrite your sentence, I would use something like
Before the transformation from the old regime to the new republican, secular regime, women had to cover their hair and faces with a hijab in accordance with the law.