Suppose we assume, as conservative Christians and Muslims do, that homosexual activity is morally wrong. One could believe this, and at the same time oppose sodomy laws, because it would empower government to snoop on everyone’s sex lives to make sure people aren’t having sex with same-sex partners. The question of moral wrongness is not sufficient to justify the state in intervening and preventing or punishing the wrongness. It is a feature of freedom that we sometimes have to give people the right to do what is wrong.
Hence it does not follow from wrongness that there should be a law against it.