Yes, let us understand how the Constitution works.
If SCOTUS rules that same-sex marriage bans are unconstitutional, that is exactly what happened. That is not legislation, it is judicial review.
Now, if that happens, all such laws are instantly invalidated. That means they no longer have the force of law. Which means all executives – state and federal – would not have any authority to enforce them. In fact would be constitutionally enjoined from enforcing them. Attempting to enforce them after that point would violate the oath of office of governors, presidents, state and federal attorneys, and law enforcement officers. There would be a handful that would try it, but they would fail.
So, yes, the President would have to follow SCOTUS. And no one but a fool or a liar would say otherwise.