What happened to morality first, Constitution second?
When I say morality, I mean standing up for basic things like marriage and life, not simply anything that has to do with religion. This ban would not criminalize people for being gay and engaging in gay behavior, rather it prevents them from getting married and so their union cannot be recognized.
As far as religion goes, several different ones are practiced. Lots of different ideas, and you can’t force people into one or the other, they have to decide for themselves. But generally all of them view homosexuality as immoral. Those that don’t aren’t moral. The Ten Commandments apply only to Christians, so criminalizing everyone wouldn’t be possible. Seeing homosexuality as immoral applies to everyone (except atheists or those who don’t practice their religion), so banning it would be done on a moral ground.