I think they know it's illegal / unconstitutional. They're banking on self-censorship by people who aren't certain where they stand legally.
Similar pieces of other contracts are valid and common and are called "non-disparagement clauses". I don't see how this differs.