Obviously, the presumption is that the judge attempts to do his job as defined by the Constitution and within the jurisdictional scope, nearly all the time, or else he simply won't be a judge for very long.
However, even though a judge, he does not cease to be human. If a conflict exists between the law of the land and the moral law, the judge must stick with the moral law and effect a positive change until such time as the gavel it pried from his dead cold hand. Resigning his position without a fight would be cowardly.
He would not have to resign his position, merely recuse himself from that case. It happens at times and is the honorable way to keep from violating either of his oaths.