That being said, one can't kick him out for his views, the constitution guarantees that. And violating that would be more of a tragedy than what happened at Ft. Hood because all we fight for would then be meaningless.
Except the UCMJ and regulation does limit constitutional rights guaranteed to other citizens. These limits have withstood challenges in court and the case law has developed what is sometimes called the J
udicial Doctrine of Military Deference. Free speech, free practice of religion, privacy rights, the right of assembly, and the right to petition are all limited to some extent. One of those important lessons from my old drill sergeant - we preserve democracy, we don't practice it.
Not only are the First Amendment rights of all military members limited to some extent, the freedom speech of commissioned officers is more limited than that of enlisted members. Two articles of the UCMJ, which limit free speech, apply to officers but not enlisted - Articles 88 and 133.
Article 88 of the UCMJ states:
"Any commissioned officer who uses contemptuous words against the President, the Vice President, Congress, the Secretary of Defense, the Secretary of a military department, the Secretary of Transportation, or the Governor or legislature of any State, Territory, Commonwealth, or possession in which he is on duty or present shall be punished as a court-martial may direct."
Article 88 is pretty clear in the type of speech that is prohibited. The provisions are limited but do impact what would normally be considered free speech. Actual prosecution at court martial is extremely rare. There has been exactly 1 conviction of an Article 88 offense since the UCMJ was enacted in 1950. It was against an officer wearing civilian clothes and carrying as sign calling President Johnson a fascist at a peace rally. He was off duty, didn't organize the rally, and did not identify himself as being a military officer during it. He was convicted and sentenced to forfeiture of pay and allowances, dismissal, and 2 years confinement at hard labor. The sentence was reduced to 1 year, and he only served 3 months before being paroled.
That's still 3 months of hard labor for carrying a sign in a political march. The Supreme Court ruled that this did not count as protected speech under the First Amendment and rejected his appeal.
Non-judicial punishment under Article 15 (which will kill an officers career), letters of reprimand, and the "opportunity" to be resign/retire are more common however. A good example is the case of Air Force MG Campbell who gained some notoriety for his characterization of President Clinton. We'll leave the exact phrase out of a family friendly forum. MG Campbell was reprimanded, fined $7,000, and forced to retire.
Article 133 states:
"Any commissioned officer, cadet, or midshipman who is convicted of conduct unbecoming an officer and a gentleman shall be punished as a court-martial may direct."
Prosecutions related to political speech under this Article are also rare. It is used more for "moral character" type violations. The last successful prosecution for political speech, that of CPT Howard Levy, charged him with making ""intemperate, defamatory, provoking, disloyal, contemptuous and disrespectful" statements under this article. Expressing his view about the war in Vietnam, and the Special Forces soldiers he refused to train, also earned him a forfeiture, dismissal, and confinement.
Article 134 applies to every service member. It's the general article which covers everything else not specifically spelled out in the other punitive articles that affects good order and discipline. Some items that are charged under Article 134 are spelled out by Executive Order. One of those is "Disloyal Statements." CPT Levy was also convicted under Article 134 for the same statements.
DOD Directive 1344.10, "Political Activities by Members of the Armed Forces" also limits free speech. While encouraging political participation it also spells out a list of political activities that are not allowed to members of the armed forces. Failure to comply can result in charges under Article 92 for disobeying lawful orders and regulations. There is also guidance on internet postings/blogging. Again violating that guidance leads back to Article 92.
I won't Monday morning quarterback/command and comment on what MAJ Hasan's chain of command could have or should have done based on the information available to them. They most certainly did have the power to discipline and/or dismiss him from service based on things that would be considered free speech when said by civilians. He retained the right to his views when he raised his right hand and swore to protect the Constitution.
He just gave up some of his rights to actually express his views.