The baker's business exists at the pleasure of the government that ratified its charter and as such is subject to rules around how they can run it. Some of those rules include how the business can filter potential customers. Sexual orientation is recognized as a protected class. Part of the baker's business is creating and selling wedding cakes. It is reasonable then to require that the baker, in their capacity of selling wedding cakes, to do so indiscriminately with respect to race, ethnicity, sexual orientation, or any other protected class _regardless_ of their religious beliefs. The supreme court opinion on this case (https://en.wikipedia.org/wiki/Masterpiece_Cakeshop_v._Colora...) did not rule on the merits so it is an open question as to the legal standing of that.