Why Was Hasan In the Army?
The question is two fold. First, why didn't he, if he was so convinced the wars in Iraq and Afghanistan were so wrong; resign his commission. He obviously had some courage in convictions to kill all those folks, but not enough conviction to resign his commission (and paycheck) as a protest.
The second is why didn't the military do something to get rid of him. That's actually pretty easy, it's called the press. Without every duck in a row, had the military tried to remove him from the service all he had to do was hire a decent lawyer and start a media battle.
Let me give you an example. The military life insurance (SGLI) has a suicide clause in it that says you receive no insurance money for suicide. Yet in 21 years in the military I saw quite a large number of them due to some of the jobs I had. In every case the family was paid the full amount of the insurance. When I asked the Captain I worked for why he said the cost of fighting the legal battle over the money was much more than just paying the insurance. A destitute wife and three kids will always win over the law infront of a jury, plus the bad publicity cost in recruiting.
In Hasan's case we have a lot of apologists in America for Muslim extremists who would be more than happy to rally around a guy getting tossed from the military for his religious beliefs. What we lack is moderate Muslims with the courage of their convictions to stand up and say "That guy is a whack job and should be tossed from the military".