SCOTUS made it possible for Trump to get the nomination and thus, the Presidency when they legalized Gay Marriage.
Trump never had to take a stand on the issue. Had he come out for gay marriage, before it became law, he probably would have lost a lot of support.
As it was, he never had to even address the issue.