Contrary to the demagoguery of some irresponsible commentators on the right, I don't think Bergdahl's release has anything to do with Obama's relationship with Islam. I think the primary motivations for the exchange were, in order:
1. It is an election year and he needs some good news to help the country forget about the Benghazi and Obamacare fiascos. Everything I have seen indicates that Obama believed that the country would be thrilled that we were releasing the last POW from Afghanistan, and he evidently thought no one would dig too deeply into the background of Bergdahl. If they did, he could always blame it on right-wing political rhetoric. This is actually a reasonable expectation given the normal tendency of the press to ignore anything that would embarrass a Democratic politician.
2. He has been under pressure from the Left to close Guantanamo as he promised to do in his 2008 campaign. We don't normally follow the far-left and of course the press will not cover their criticisms, but they have been furious with Obama for five years over this. Since it is a really bad idea on several levels, the country would never go for it, but he seems to think that he can appease both sides with a prisoner exchange. He gets to look like a patriot for bringing back our soldier and he gets to look like a champion of justice for closing down Bushitler's torture chamber. Win, win.
3. If you don't look too closely, he gets to prove that negotiation with the Taliban can work. His whole foreign policy is based on the idea that we don't need a strong military if we take the time to understand foreign cultures and show them that we can be reasonable. This is important because he just got completely outclassed by Putin over the Ukraine, and also because of his failures with Syria and the whole Arab Spring fiasco. So he needs to look like a shrewd negotiator, even if the deal wasn't a very good one. Again he is relying on the press to paint everything he does in the best possible light.
Here is a good analysis by Allahpundit from HotAir which largely agrees with me, though he puts some of the factors in a different order. Look especially at the last paragraph:
The media’s assuming that the White House wanted an American POW back so badly that they’d reluctantly agree to release five very dangerous Taliban to make it happen. In reality, maybe the reasoning went the other way. Maybe, in the name of finally closing Gitmo, they were eager to get rid of the five Taliban but realized that they couldn’t free them without paying a heavy political price. If, however, they could get the last American prisoner in Afghanistan back as part of a trade, that might give them enough cover to make it happen. It wasn’t Bergdahl who drove the deal, in other words, it was springing these guys from Gitmo. Bergdahl was just a bit of political sugar for the White House that’s now suddenly turned sour on them.
The rest of the article has some good analysis of how and why this all went wrong for Obama.
For some further relevant information look at these stories:
Here is an early report from CNN before the trouble started. This is how the story was supposed to play out. Note that there is no suggestion that Bergdahl deserted (even though he was publicly investigated in 2010):
Bergdahl was deployed to Afghanistan in May 2009. He was 23 when he was captured by the Taliban after finishing a guard shift at a combat outpost on June 30, 2009, in Paktika province.
Note also, this paragraph (near the end of the article):
A senior administration official told CNN, "With regard to whether or not we're negotiating with terrorists: Sergeant Bergdahl is a member of the military who was detained during the course of an armed conflict. The transfer of these individuals is not a concession -- it is fully in line with the President's goal of closing the detention facility at Guantanamo Bay."