The president delivered remarks from the White House on the exchange, which officials said he was directly involved in helping negotiate.