A video went viral this week, showing a man throwing yogurt at two unveiled women in a shop near the holy Shi'ite Muslim city of Mashhad.
President Ebrahim Raisi said in response on Saturday that the hijab was the law in Iran.
Growing numbers of women have defied authorities by discarding their veils after nationwide protests that followed the death in September of a 22-year-old Iranian Kurdish woman in the custody of the morality police for allegedly violating hijab rules. Security forces violently put down the revolt.
Judicial authorities in a town near the northeastern city of Mashhad issued arrest warrants for the man seen pouring yogurt over the heads of the two women, a mother and her daughter. They were also the subject of arrest warrants for flouting Iran's strict female dress rules, state media reported.
Risking arrest for defying the obligatory dress code, women are still widely seen unveiled in malls, restaurants, shops and streets around the country. Videos of unveiled women resisting the morality police have flooded social media.
In live remarks on state television, Raisi said: "If some people say they don't believe (in the hijab)... it's good to use persuasion ... But the important point is that there is a legal requirement ... and the hijab is today a legal matter."
Authorities said the owner of the dairy shop, who confronted the attacker, had been warned. Reports on social media showed his shop had been shut, although he was quoted by a local news agency as saying he had been allowed to reopen and was due to "give explanations" to a court.
Threatens no mercy for unveiled women
Judiciary chief Gholamhossein Mohseni Ejei earlier threatened to prosecute "without mercy" women who appear in public unveiled, Iranian media reported.
"Unveiling is tantamount to enmity of (our) values," Ejei was quoted as saying by several news sites.
Under Iran's Islamic sharia law, imposed after the 1979 revolution, women are obliged to cover their hair and wear long, loose-fitting clothes to disguise their figures. Violators have faced public rebuke, fines or arrest.
Describing the veil as "one of the civilizational foundations of the Iranian nation" and “one of the practical principles of the Islamic Republic,” an Interior Ministry statement on Thursday said there would be no “retreat or tolerance” on the issue.
It urged citizens to confront unveiled women. Such directives have in past decades emboldened hardliners to attack women without impunity.