Not everything can be trademarked. Besides flags, people's names without their consent, and geographical locations, profane trademarks are not approved for registration.
Is this a violation of First Amendment rights?
The U.S. Supreme Court will answer that question soon as they have agreed to hear the USPTO's appeal of Erik Brunetti's successful appeal to the U.S. Court of Appeals for the Federal Circuit in Washington.
For now, the Trademark Manual of Examining Procedure holds. Section 1203.01, "Immoral or Scandalous Matter", describes what is immoral and/or scandalous, how the determination is made, and its grounding in both statutory and case law. It is surprisingly good reading.