Foul language or (Indecent Language) can be charged under the Military Manual for Courts Martial. 104 Article 134, page IV148. It states in part.
c. Explanation. Indecent language is that which is grossly offensive to modesty, decency, or propriety, or shocks the moral sense, because of its vulgar, filthy, or disgusting nature, or its tendency to incite lustful thought. Language is indecent if it tends reasonably to corrupt morals or incite libidinous thoughts. The language must violate community standards. See paragraph 62 if the communication was made in the physical presence of a child.
Check out the maximum punishment:
d. Maximum punishment. Dishonorable discharge, forfeiture of all pay and allowances, and confinement for 5 years.