Botswana's government spokesman Jeff Ramsay told the BBC the dress code applied to both men and women.
Our correspondent in the capital, Gaborone, says headscarves are a traditional part of women's outfits in Botswana.
He says the ruling may force quite a number of government employees - especially the younger ones - to overhaul their wardrobes.