Bergdahl claimed he had left his post in 2009 to walk through the Taliban-filled eastern Afghanistan countryside to a larger United States base to report command problems in his unit.
He plead guilty last month to charges of desertion and misbehaviors before the enemy.
In court, Bergdahl appeared tense, grimaced and clenched his jaw.
Prosecutors had demanded harsh punishment, calling on testimony from witnesses injured - including one soldier shot in the head and permanently disabled - while on search missions in eastern Afghanistan after Bergdahl disappeared in 2009.
While running for president, Trump disparaged Bergdahl, 31, as a "dirty rotten traitor" and called for him to be executed by firing squad or tossed out of a plane without a parachute. "Ok, whoop-de-doo".
In 2009, Bergdahl abandoned his outpost in Afghanistan and was captured by the Taliban.
"The decision on Sergeant Bergdahl is a complete and total disgrace to our Country and to our Military", Trump tweeted from Air Force One, as he headed to Asia for a marathon trip of almost two weeks.
He will be dishonorably discharged with his rank reduced to a E1, and he will forfeit $1,000 per month for 10 months.
Bergdahl appeared visibly shaken as the sentence was announced, according to CNN affiliate WRAL.More news: Gordon Hayward Is Out Of His Cast, Taking Shots
The White House said it had no comment on the sentence and referred back to a statement from several weeks ago that said Trump expects everyone in the military justice system "to exercise their independent professional judgment, consistent with applicable laws and regulations".
Bergdahl admitted his guilt without assurances from the prosecution about his sentencing, hoping for leniency before the judge.
But Captain Nina Banks, for the defence, said that when he deserted Bergdahl had not yet been diagnosed with schizotypal personality disorder, which includes grandiose thinking.
Prosecutors had recommended a sentence of 14 years of in prison.
"Sgt Bergdahl does not have a monopoly on suffering as a result of his choices", said Major Justin Oshana.
The sergeant already has a job offer from an animal sanctuary, and a military official who helps design survival training said he would like to use Bergdahl as a part of lectures to service members on how to survive captivity.
Bergdahl became a political talking point in 2014 after President Barack Obama's administration traded five detainees at Guantanamo Bay in exchange for his release.
During an interview earlier this year, Bergdahl claimed he was treated better by the Taliban than the U.S. Army. Mr Obama said at the time the USA does not leave its service members on the battlefield.
During the presidential campaign, Triump called Bergdahl a "traitor" who deserved serious punishment.