National Law Journal has an op-ed, "When Soldiers Go Social On Politics," that responds to vitriolic social media comments from members of the military, and says there are limits to what soldiers can say about the president publicly:
The U.S. Supreme Court, in Parker v. Levy (1974), upheld provisions of the Uniform Code of Military Justice that prohibited a Navy doctor from expressing anti-war sentiment to fellow seamen and encouraging African-American seamen to refuse to go to Vietnam. The Levy court explained the justification for limitations on military expression as deriving from the "fundamental necessity for obedience, and the consequent necessity for imposition of discipline, [which] may render permissible within the military that which would be constitutionally impermissible outside it." Because of this, the "different character of the military community and of the military mission" allows for a "different application" of free speech protections under the First Amendment.