Having to say something means that you really need to say something about the matter at hand; it means that your opinion is needed at that point in time; that is to say that you have to say something, which in other words means that you should say something.
I know that this insight from John Dewey is somewhat confusing, but this is the kind of insights you should expect from not just a philosopher only or a psychologist only, but someone who is both a Philosopher and a Psychologist, that was who John Dewey was before death.
In recapitulation, know when to say something and when not to say something; words spoken out can never be taken back, hence the need for you to be wary of what you say.
Say the right thing when you have to say something, and having something to say doesn’t mean that you should say it, but do so if it matters.
Therefore, when you have something to say, which is the right thing to say, then say it because you really have to say something.