The US president warned the military base on Diego Garcia may be needed to respond to possible attack from Iran.