If we mistake the law for a definition of morality, then it becomes impossible by definition for the law to be wrong.
The President must realize that the law does not define morality. And of course he does; born in 1961 he is beyond doubt keenly aware that US laws do not define morality. He is conflating the concepts for political reasons.
By the same token, this is why it's always idiotic to talk about "the people". It is always wrong to say "the people chose" or "the people believe" or "the will of the people". Real life isn't a musical set in Paris starring Jean Valjean.
The law has always been reflecting the power balance and nothing more. It reflects morality only as a consequence of and to the extent to which moral people have power.