US President Donald Trump has threatened military action over the Islamic republic's nuclear programme.