US president says the move to restrict foreign student visas at Harvard is to safeguard national security.