Imagine you want to settle a dispute with someone, and agree that you won't pursue it further in court. Generally, that's a
very wise thing to do, when possible. Preparing for and doing a trial is
extremely expensive and disruptive. Rarely is your own case as strong as you feel emotionally, and you truly have no flipping idea if you'll win. Even if you do win, it can be appealed. When all the appeals are done, even if you still won, can you even collect all the money? And what about the years of your life gone by?
OK great. So, you're able to settle on terms both parties find awful -- but better than the alternative. Whew. But a month after you do, your opponent might go out there trash-talking. Then you do, in response. And your whole settlement has unraveled.
As a result, it is entirely normal and appropriate for two parties who aren't stupid, to agree to remain silent.
If the settlement has one party paying the other (as is often the case), you can imagine that they will pay somewhat more for a final settlement -- one that doesn't unravel -- because that's worth more.
It's nothing to do with gags or free speech. It's just the kind of painful common sense you acquire from having gone through any sort of legal dispute -- or if you haven't, that hopefully your attorney has, and hopefully you are listening to her advice that you're paying for.