There is a difference between that which you consider wrong for yourself and that you consider wrong for others. When someone asks if you think eating meat is wrong, they usually mean “for yourself.” I would not assume that someone who said that “yes, eating meat on Good Friday is wrong” to mean “it is wrong even for people who don’t adhere to my religion.” If they did think so, then I would be concerned. (Fortunately, this is not a big issue, so they could probably still be a relatively unbiased judge, as long as they recuse themselves from meat cases.)
On the other hand, everything about the claim that gay marriage is a sin is about other people, outside of your religion. It’s all about controlling those people. As such, if someone says they don’t think gay marriage is a sin, then I’m pretty sure they mean “I believe gay people shouldn’t be allowed to marry.”
And that latter belief is a problem. Sure, you can enforce the law regardless of your beliefs. But that’s not automatic. It is a bias, and one that should be scrutinized heavily. Even if you will enforce the law, your beliefs still inform what you do, and so thinking SSM is wrong can lead to you siding against it in gray area cases.
It could, for instance, lead to allowing religious exceptions to anti-discrimination laws about gay people–something that the “gay marriage is sinful” people seem to be trying for. It’s why they are trying to make it where cake-makers can refuse to make cakes for gay weddings, even if that cake is identical to one they would make for a straight wedding.
We want judges who are biased towards the law. The law says that gay marriage is the same as straight marriage. So we want people who are biased towards thinking that gay marriage is the same as straight marriage morally. Those have the best chance of enforcing the law fairly.
The thing about prejudice is that it prevents people from making the rational choice, without knowing that’s what they are doing. That’s why assuming judges can just put aside their biases is a bad idea. People largely don’t know when their bias is kicking in.