The row has now spilled over into Turkey, Baku’s closest ally, which provided vital support during Azerbaijan’s 2020 war with Armenia over Nagorno-Karabakh.
The two countries call themselves “one nation, two states”.
President Recep Tayyip Erdoğan, a devout Muslim, has spoken of creating a “pious generation”.
His chief adviser, Oktay Saral, has called the Azerbaijani restrictions “unacceptable” and urged Baku to “reverse this mistake”.
“A headscarf is not an obstacle; it is a requirement of one’s faith!” Saral wrote on X.
Several MPs from Turkey’s governing AK Party joined in.
Small demonstrations were held outside Azerbaijan’s embassy in Ankara, organised by Köklü Değişim, an Islamist movement linked to Hizb ut-Tahrir, and outside its consulate in Istanbul, organised by conservative Islamist group Özgür-Der.
President Aliyev’s New Azerbaijan Party accused Turkish officials of an “openly defamatory” information campaign and of “baseless accusations”, warning that Oktay Saral’s comments risked harming ties, and cautioned against interference in Azerbaijan’s internal affairs.
Earlier this month, Ilham Aliyev himself said no one should “stick their noses into our way of life”.
Behind the dispute there may lie another source of friction. Turkish protesters have linked the headscarf rules to Azerbaijan’s close ties with Israel, which sells weapons to Baku and buys Azerbaijani oil.
Turkey’s relations with Israel have collapsed over Gaza, but Azerbaijan has tried to maintain relationships with both countries.
That is a difficult balancing act. On Thursday, when Israel’s President Isaac Herzog addressed a regional security summit hosted by Azerbaijan in Baku, delegations from Turkey, Iran and other countries walked out of the hall.