The maximum punishment for desertion during a time of war is death. But it’s highly unlikely Sgt. Bowe Bergdahl, who allegedly left his Afghanistan post in 2009, or any troop today would receive that sentence. The last service member executed for desertion was Pvt. Eddie Slovik in 1945 (by a twelve-man firing squad).
There were over 20,000 American military deserters between 2006 and 2015. Of those, about 2,000 have been prosecuted.
This short TestTube News video explains the severity of desertion and its place in military history.