The incident happened as Mr Trump was answering a question about efforts to secure the release of hostages from Gaza.