School districts / states do generally have the power to set the curriculum including the viewpoint that will be officially conveyed. One well-known major restriction on such viewpoint restrictions is that the schools cannot restrict the free exercise of a religion, and cannot take a position on a religion. Apart from the religion third-rail, schools have pretty free reign in setting the curriculum, see Evans-Marshall v. Tipp City for one instantiation. In this case, the teacher assigned various books, including Heather Has Two Mommies, one of the books that prompted an outcry. The upshot of that case is that a teacher cannot invoke the First Amendment to override policy.
This article (draft version, easier to handle) (published version, annoying footnote structure) reviews the topic, and section III covers prior cases. It notes that the cases of Lawrence, Windsor, Obergefell do not address the constitutionality of these education laws, though the reasoning in the prior cases might be applicable if there were a suit over curriculum. There is an implication that some of these rules have been enforced in the past, but most of the evidence is in the form of news stories (Beall v. London City School BOE is not available in the open). The article does engage in a somewhat deeper study of enforcement in Utah, where it was enforced (until it was repealed).
Enforcement is necessarily indirect. The law require school districts to have a particular curriculum; violation would come when an individual teacher taught contrary to the prescribed curriculum. Those laws do not contain any provision like "a teacher who violates these rules gets fired", instead, punishment is via the general rule that you have to teach what is in the state-mandated curriculum. Rather than officially terminating a teacher for violating this curricular guideline, districts use vague reasons for non-renewal such as "due to problems with communication and teamwork" (from Evans-Marshall).