The United States has long held that creative work, art basically, is a form of Speech and protected under the 1st Amendment. This means that compelling art is the same compelling speech and boy howdy are there a bunch of laws around that, laws that society really needs to have.
So it’s a collision between rights:
On the one side we have the Photographer and their Constitutional Claims to not be compelled to create art (speak) and their right to not do something that is against their religion.
On the other side we have a LGBTQ person and their Constitutional Claim to not be denied services as a member of a protected class.
We currently draw the line by protecting the right to not be compelled to speak. In practical terms this means that buying a standard per-packaged Good or Service cannot be denied to people in a protected class. If a member of that protected class wants to purchase a Good or Service that would require creative input then the seller can refuse.
It becomes more clear if you create a scenario where someone in a protected class wants something distasteful. Let say that this Nazi here is gay and getting married to this Nazi here. They roll into one of these fine bakeries in New York and demand a custom cake in the shape of Hitler standing on a base that says “Blood and Soil” with little red fondant swastikas between each letter.
They also need a wedding photographer but their Hitler Themed wedding has a 7’ tall statute of the guy standing underneath a banner that says “Arbeit Macht Frei” and they really want a shot of the two of them standing next to that statue in their finest Hugo Boss tuxedo’s while they both kiss Hitler’s cheeks.
So how does Society decide this mess? Do we force the Jewish bakery to make that cake because the buyers are minorities and gay? Do we force the photographer to take those pictures? Would YOU want to be forced to do either of those?
I sure as hell wouldn’t because what they want is deeply and personally offensive. This is why we protect against compelled speech.