The decision is effectively a green light for the states to ban the Islamic headscarf, or hijab, in educational establishments.
It comes a few days after the French prime minister said there was no place for the hijab in French schools.
And it also follows the recent explusion of a Canadian Muslim teenager from a school in Quebec for wearing a headscarf.
However, the Karlsruhe court also ruled on Wednesday that a regional state was wrong to ban a teacher from wearing a veil in the classroom.
In a long-awaited decision on freedom of expression and religious neutrality, the court overturned a lower court's ruling that Baden-Wuerttemberg was justified in refusing to hire a Muslim teacher who insisted on wearing a headscarf.
The teacher, Fereshta Ludin, had fought her way to the highest tribunal to win the right to work in public schools with her head covered according to her religious beliefs.
Baden-Wuerttemberg had argued a teacher with a headscarf violated "the strict neutrality of public schools in religious issues" and could have undue influence on impressionable young children.
But the court ruled that states must find "arrangements acceptable for everyone" in striking a balance between religious freedom and neutrality in schools.
It said states were within their rights to determine that headscarves and other religious symbols should be outlawed in the classroom.
But it added the issue was too contentious to be decided on an ad hoc basis and required a legal framework.
The court ruled it was possible, although not scientifically proven, that children could be influenced by the religious dress of their teachers, provoking conflicts with parents.
The headscarf worn by some Muslim women has long been considered normal in Germany ... In the debate on the Muslim headscarf, this piece of cloth is often a surface on which to project fears, anxieties and hasty generalisations"
German immigration, refugees and integration spokeswoman
Following the verdict, the Central Council of Muslims in Germany blasted the decision as opening the door for states to issue blanket bans on teachers wearing headscarves in schools.
"That would be a severe action against Muslims," council chairman Nadim Elias said, adding that women wearing headscarves had become part of "everyday life" in Germany.
Ludin today works at an Islamic school in the Berlin district of Kreuzberg, which has a large Turkish Muslim population.
She argued in the case that her religious beliefs posed no threat to Western values.
"I consider religion part of my identity," the 31-year-old told the court at the first hearing in June.
"So are democratic values," she added.
Marieluise Beck, the federal government's immigration spokeswoman, refugees and integration, had been a vocal supporter of Ludin's case.
"The headscarf worn by some Muslim women has long been considered normal in Germany," she said in a statement.
"In the debate on the Muslim headscarf, this piece of cloth is often a surface on which to project fears, anxieties and hasty generalisations," she added.