What student BB seemed to be missing was an understanding of the lyrics of this last song. No one can compel you to pledge allegiance even if they want you to recite the words. It's no different that being in church and not taking part in communion or reciting the Apostle's Creed and any other part of the rituals that do not feel right.This is entirely true, and why I do not bother to object to swearing an oath even if there is an "affirmation" option, if that might be socially awkward. It is a trivial matter that means little to me.
However, there are those, like the Jehovah's Witnesses in West Virginia State Board of Education v. Barnette, for whom swearing an oath or pledging allegiance to anything other than their God is a profound insult to their core beliefs. Essentially, to force such a person to make such a pledge or an oath, with the power of the state behind the coercion, is to force them to betray their religion.
I do not believe religious beliefs are entitled to any greater or lesser protection than other sincerely held beliefs. If someone feels that taking a pledge or an oath, even in vain, is to them morally repugnant, they should not be forced to do so by the state. Nor should receiving an education, a fundamental right, be conditioned upon giving up another.
A book that I found encapsulates my own moral and philosophical beliefs against coerced speech is The Freedom Not to Speak by Haig Bosmajian. This book, which I read years ago, cemented my beliefs that not only is the state without legitimate power to coerce any form of speech, but that this principle is also enshrined in the First Amendment and that disregarding it has always been abusive.
The right not to be forced to say a pledge is not based upon whether or not I approve of the speaker or the beliefs that lead to the refusal. Frankly, I detect more than a trace of a nasty, nativist mentality specifically directed at Mexicans. Had I received the same assignment in high school, I might not even have considered the implications of a pledge. I did take German and am pretty sure I recited the anthem at some point.
I think this case would be rather different had the assignment been simply translating the pledge, or some other piece of literature. For example, a Latin student who refused to translate a passage from Caesar's Gallic Wars, a common assignment I did in high school myself, would not have a leg to stand on if complaining that his opposition to war in all forms made translating this passage an exercise in militarism. However, a pledge or an oath are very special kinds of speech.
Personally, I am concerned more with the substance of speech than its form. So if I take an oath not to commit perjury, its substantive content is that I am aware perjury is a crime, and that the power of the state can rain down hellfire on me if I lie under oath, and that if I value my honor, I will not lie. Okay, so they threw in a gratuitous God that I don't believe in. Fine. Whatever. The substance is the same. I'm not going to throw a fit about it.
There are those, though, whose beliefs are less yielding, and to whom being forced to say something like a pledge that they do not believe in is a grievous insult to their true beliefs. The state should not have the power to force people to utter words of oath or allegiance or be punished, with bad grades or anything else. There is virtually no compelling state interest that people be forced to pledge allegiance to a foreign country. With a trivial change in curriculum, it is possible to accommodate such beliefs without in any way interfering with valid pedagogical objectives.
Therefore, I think that if the facts are as alleged in the complaint, the plaintiff has a legitimate case that should be heard and decided in her favor.
Edit: I should note that while I use legal terminology here and there throughout this post, I also describe education as a "fundamental right," a phrase with a specific legal meaning. However, education has not, in fact, been recognized as a fundamental right by the Supreme Court, in one of their worst errors. In contrast, New Jersey's state courts have, in fact, recognized education as a fundamental right. I think that the Supreme Court should recognize what I believe to be a fundamental right, but it hasn't, and so that statement is "legally" wrong. I contend that it is right in reality. Anything else I say about law in this post is, in my opinion, correct, though.