Politics and the military at times do not mix.
Like it or not the military through statute and regulations is allowed to put some limits on speech, including political speech. The links below try to address some of the issues that sometimes arise.
If you have a concern, consult a military defense lawyer to help navigate sometimes very complex rules. If you have the chance and time it is better to check first.