It is an all volunteer military. Bergdahl knew that killing Mudslimes would be required in the line of duty. His desertion caused the deaths of Americans, so yes, he deserves the firing squad if it is found out that he deserted his post in wartime.
I honestly have an issue with this. I think death for desertion should only come in a declared war, as in declared by the U.S. Congress. Think of this scenario, some authoritarian asshole gets control of the U.S., replaces high-level general officers who aren't his biggest supporters, with officers that are in his camp. Those officers, on his order, send in the military to start rounding up people deemed to be "threats to national security" for, oh, I don't know, supporting the 2nd Amendment, believing in national sovereignty and exceptionalism, supporting the abolition of the IRS, are Christian, etc. Then, the troops under the general officers who are in his camp decide, "hey, **** this, I'm not turning my weapon on the American populace", and get the hell out of Dodge. When they're found, they are executed as deserters.
That I would have a problem with.
As for Bergdahl, I'm all for sending his ass to Leavenworth for life.