The Torah commands in Parashat Behar (25:17), “Ve-lo tonu ish et amito” (“Do not mistreat one another”), which Chazal (Torat Kohanim and Bava Metzia 58b, cited by Rashi) understood as referring to the prohibition of ona’at devarim – inflicting pain through the spoken word. The Gemara (there in Bava Metzia) gives a number of different examples of ona’at devarim, including telling somebody that the suffering he endures is the result of his misdeeds, insulting a person, and recalling embarrassing mistakes of the past. This prohibition is listed by the Rambam as one of the 365 Biblical prohibitions (lo ta’aseh 251).
The Sefer Ha-chinukh (341), in his discussion of this prohibition, famously qualifies this command as referring to initiating hurtful comments. If, however, a person is confronted by somebody who insults him, he is entitled to defend himself and respond in kind. The Sefer Ha-chinukh explains that for most people, it is simply impossible to remain silent in the face of insults, and, moreover, remaining silent can easily be interpreted as tacit agreement to what is being said. A person has no obligation to appear as though he accepts insults being hurled at him, and so he is absolutely allowed to respond.
Later in his discussion, the Chinukh cites the Gemara’s famous comment in Masekhet Shabbat (88b) extolling the virtue of “ha-ne’elavin ve-einan olevin, shom’in cherpatam ve-einam meshivin” – “those who are insulted but do not insult, who hear their shame but do not respond.” Seemingly, this Gemara proves that to the contrary, one should remain silent in the face of humiliating insults, rather than respond. However, the Sefer Ha-chinukh explains that the Gemara speaks here not of a strict halakhic requirement, but rather of a special level of piety which extends beyond the letter of the law. He writes that the people described by the Gemara are “a group of people whose piety grows to such an extent that they do not wish to bring themselves to this ruling, and respond to those who shame them, lest anger overcome them and they will go too far…” Although it is certainly permissible to respond to insults, and for the vast majority of people, it is impossible to expect them to remain silent in the face of abusive speech, nevertheless, there is value, for those who are capable, in keeping silent as a safeguard against an excessive response. As the Chinukh writes earlier, the halakha allowing one to respond in kind to those who speak to him abusively does not authorize unrestrained anger, which is never permitted. One is allowed to defend himself, but not to lose his composure and erupt in a fit of rage, even against those who insult him. Hence, the especially pious make a point of remaining silent in the face of insults, despite their halakhic right to respond, in order to ensure that their response does not lead them to inappropriate anger.