In 1942 the West Virginia State Board of Education ordered that all teachers and pupils be required to participate in the Pledge of Allegiance, and that refusal to do so would “‘be regarded as an Act of insubordination, and’” would “’be dealt with accordingly.’” (West Virginia State Board of Education v. Barnette, Opinion, p. 626)  The penalty for refusal was expulsion, and the student couldn’t be readmitted until he or she complied. (Id, p. 629) Moreover, the expelled child could be dealt with as a delinquent, and the parents or guardians could be prosecuted. (Ibid.)
This requirement fell particularly hard on Jehovah’s Witnesses, who believed that saluting the flag was an act of idolatry (a belief they still hold). (Ibid.) Some of their children had been expelled and threatened with being sent to a juvenile reformatory, and some parents had been either threatened with prosecution or actually prosecuted. (Id, p. 630) Certain adherents of the religion brought suit, seeking an injunction prohibiting enforcement of these laws and regulations against Jehovah’s Witnesses. (Id, p. 629)
The case made its way to the U.S. Supreme Court, which didn’t decide the case on Freedom of Religion grounds, as might be expected, but on the basis of Free Speech. And what the Court saw before it was “a compulsion of students to declare a belief.” (Id, p. 631) This the Court found unacceptable, and ruled that the First Amendment rights of Jehovah’s Witnesses were being violated.
“The rationale of Barnette became the basis for the Court’s decision in Wooley v. Maynard, which voided a requirement by the state of New Hampshire that motorists display passenger vehicle license plates bearing the motto ‘Live Free or Die.’ Acting on the complaint of a Jehovah’s Witness, the Court held that the plaintiff could not be compelled by the state to display a message making an ideological statement on his private property. In a subsequent case, however, the Court found that compelling property owners to facilitate the speech of others by providing access to their property did not violate the First Amendment. Nor was there a constitutional violation where compulsory fees were used to subsidize the speech of others.
“Other governmental efforts to compel speech have also been held by the Supreme Court to violate the First Amendment; these include a North Carolina statute that required professional fundraisers for charities to disclose to potential donors the gross percentage of revenues retained in prior charitable solicitations, a Florida statute that required newspapers to grant political candidates equal space to reply to the newspapers’ criticism and attacks on their records, an Ohio statute that prohibited the distribution of anonymous campaign literature, and a Massachusetts statute that required private citizens who organized a parade to include among the marchers a group imparting a message—in this case support for gay rights—that the organizers did not wish to convey.” 
From the standpoint of Catholic teaching it appears that the baker’s religious freedom was manifestly violated. But from the constitutional perspective, a future baker’s best argument will be made on Free Speech grounds. Protection of religious freedom is not as strong in the United States as one might think, falling, as it does, before neutral laws of general applicability.
It is beyond the mission, indeed the competence, of this blog to attempt to give instructions to Catholic bakers on how to respond to this new situation. Instead, consultation with one’s pastor is recommended. I will only make the observation that, from the standpoint of Catholic morals, there can be no more justification in baking a wedding cake for a different-sex couple, where it is known to the baker that at least one of them is still bound by a prior marriage, than for a same-sex couple.
The icon of St. Joseph the Worker is by Daniel Nichols.