In that case it would be amusing, and fair game. But good luck trying to get an Nadiya Hussain to make a cake saying 'Mohammad was gay and only wanted sex with young boys'.
That depends on whether the person ordering the cake wanted to make a point or not. They could have kept going back to the shop and asking for increasingly awkward slogans for the shop to make.
'Christians who don't support gay marriage will go to hell'
etc
Not aimed at you Knocky:
What if...
That is what happened. The local courts in Northern Ireland ruled against the bakery, saying they had to make the cake.
So you could get Nike to print a shirt saying 'We used children under 10 in sweatshops to make this shirt, so we could maximise our profits. Child slavery for the win!'