President Barack Obama said in a written statement that he was honored to call Sgt. Bergdahl's parents "to express our joy that they can expect his safe return, mindful of their courage and sacrifice throughout this ordeal."
On Saturday evening, Mr. Obama made a surprise appearance in the White House Rose Garden together with Mr. Bergdahl's parents.
"While Bowe was gone, he was never forgotten," Mr. Obama said, adding that the U.S. does not ever leave its men and women in uniform behind.
"We're committed to winding down the war in Afghanistan, and we are committed to closing Gitmo," he said. "But we also made an ironclad commitment to bring our prisoners of war home. That's who we are as Americans."
Bob Bergdahl said his son is having trouble speaking English and that his recovery will be a "considerable task for our family."
Though Taliban leaders have so far balked at entering peace talks with the U.S., Obama administration officials said they hoped the prisoner exchange would lead to a broader dialogue as the U.S. withdraws its forces from Afghanistan.
"It is our hope Sergeant Bergdahl's recovery could potentially open the door for broader discussions among Afghans about the future of their country by building confidence that it is possible for all sides to find common ground," Mr. Obama said in his statement.
Freed American soldier Bowe Bergdahl's parents Bob and Jani Bergdahl look on while U.S. President Barack Obama speaks to the press. Agence France-Presse/Getty Images
A defense official said the transfer was done in compliance with current U.S. law that mandates notification of Congress before detainees are transferred. "We have a memorandum of understanding with the government of Qatar, we have the appropriate security assurances from them," the defense official said.
But Rep. McKeon and Sen. Inhofe were critical of the swap. In a statement Saturday, they said "America has maintained a prohibition on negotiating with terrorists for good reason." The prisoner exchange "may have consequences for the rest of our forces and all Americans," they said. "Our terrorist adversaries now have a strong incentive to capture Americans. That incentive will put our forces in Afghanistan and around the world at even greater risk."
Sen. John McCain, an Arizona Republican, welcomed Sgt. Bergdahl's release, but called the Taliban detainees being transferred to Qatar "hardened terrorists who have the blood of Americans and countless Afghans on their hands."
Senate Majority Leader Harry Reid (D., Nev.) praised those who worked to secure the release of Sgt. Bergdahl. He also said that President Obama "rightly recognized our solemn obligation to take every possible measure to protect and defend the men and women who serve our nation."
The U.S. identified the five Afghan detainees as Mohammed Fazl, Noorullah Noori, Abdul Haq Wasiq, Khairullah Khairkhwa and Muhammad Nabi Omari. U.S. officials said they had departed Saturday from Guantanamo Bay to Qatar aboard a U.S. military aircraft.
The five were labeled as high-risk, according to secret independent assessments by the U.S. Defense Department that were made public by WikiLeaks.
Mr. Khairkhwa, the Taliban's former Minister of Interior, was one of the Taliban's liaisons to al Qaeda leader Osama bin Laden, according to Defense Department assessments. Mr. Wasiq served as the Taliban's deputy minister of intelligence until the Taliban was overthrown in 2001.
Qatar has provided the U.S. with assurances that the five detainees, once they arrive in Qatar, won't pose a threat to the U.S. These assurances, according to U.S. officials, include at least a one-year travel ban, which bars them from leaving Qatari territory.
Then-Pfc. Bergdahl was captured on June 30, 2009, by militants after leaving his U.S. base in Paktika province in eastern Afghanistan. The circumstances surrounding his decision to walk off the base have remained murky.
While a prisoner, he has received regular military promotions. However, the circumstances of his captivity have never been clear. U.S. officials have said he was believed to be held for most of the last five years in Pakistan by the Haqqani network, an insurgent group that is allied with but separate from the Taliban, and not directly by the Taliban.
But officials said Sgt. Bergdahl was handed over by Taliban, not Haqqani militants.
The U.S. held secret discussions with the Taliban starting in late 2011 and early 2012, but the Taliban broke those contacts off. The U.S. hasn't had any direct talks with the Taliban since then, except for messages relayed back-and-forth through intermediaries, most important the government of Qatar.
Sgt. Bergdahl appears in an image taken from a video released by the Taliban. Associated Press
Last year, the Taliban opened an office in Qatar, a move backed by the U.S. as part of negotiations aimed at securing Sgt. Bergdahl's release. That effort soon bogged down in controversy and was abandoned.
Then last November, the Taliban signaled to the U.S. that it was prepared to restart indirect talks on the limited issue of a prisoner exchange. The Taliban leaders involved, however, made clear that they weren't prepared to discuss the broader issue of reconciliation, U.S. officials said.
The talks progressed relatively quickly. First, the Taliban provided the U.S. with a "proof of life"—a video released earlier this year that showed Sgt. Bergdahl alive. The Americans, in turn, agreed to release all five Afghan Taliban detainees at Guantanamo Bay at one time, instead of in stages.
"Several weeks ago an opportunity arose to resume talks on Bergdahl and we seized that opportunity," a senior defense official said.
The final prisoner swap negotiations were secretly conducted through Qatar, which acted as a mediator, passing messages back and forth.
Prisoner swaps have been rare, but not unprecedented, during the Iraq and Afghanistan wars. The Qais and Laith Qazali, two brothers accused of killing U.S. soldiers in Iraq, were released by Iraqi officials in exchange for a British hostage and the bodies of four other U.K. nationals, although the U.S. publicly denied the brothers were freed as a prisoner exchange.
—Colleen McCain Nelson contributed to this article.
Write to Adam Entous at adam.entous@wsj.com and Julian E. Barnes atjulian.barnes@wsj.com