The president warned Iran to stop arming the militant group, which has been attacking ships in the Red Sea.