The ruling conservative Christian Social Union (CSU) said on Thursday that the ban, which has already been introduced in four of Germany's 16 federal states, was designed to protect pupils from the influence of "Islamic fundamentalism".
"The veil is widely abused by Islamic fundamentalist groups as a political symbol," said Bavaria's culture minister Monika Hohlmeier.
The Social Democratic Party (SPD) and Greens, who rule in a coalition on a national level, voted against the ban in the regional parliament and said it was questionable from a legal point of view.
Headscarf bans for teachers have already been introduced in the states of Hesse, Lower Saxony, Baden-Wuerttemberg and Saarland. In Hesse the ban applies to all civil servants.
However, the bans stop short of banning school pupils from wearing Islamic headscarves.
Germany is home to more than three million Muslims.
Islamic groups say the headscarf is a religious obligation and not a political statement.
Muslims say hijab is a religious
obligation, not a matter of choice
France introduced a ban on state school pupils and teachers wearing headscarves earlier this year, sparking fierce criticism from some Muslim groups that it represents a form of discrimination against Islam.
At least six schoolgirls have been expelled from classes in France for wearing a headscarf since the new law was introduced.