Hypothetical other explanations: 1.) Obama always had the same views, but was lying to get elected 2.) Obama changed his mind, a possibility for any person on any topic 3.) Becoming president gave Obama new information which changed his mind, and which would change the mind of anyone elected president 4.) His opinions stayed the same, but now that he's president it's in his best interests to take this stance, which it wasn't before
There's more than one possible cause here, and possibly more than one of them are the case. Despite the fact that it's much easier to blame external influences.