Sarcasm derives from sarcos implying to "cut flesh," but was used by the ancients already to mean a "cutting" or "biting" remark.
It is related to irony and satire, both of which enable us to regard things from "two standpoints," destabilizing the uniform certainties of dogma. For Rorty, "irony" is a hallmark modern liberalism, in the best sense. The capacity to "see the other side" of an issue and to refrain from excessive self-certainty and unilateral judgments.
Some of this ethical value may be found even in the mocking or "biting" form of sarcasm. For the ancient Greeks, sarcasm was characteristic of the Cynics, the most famous of whom was Diogenes, the wandering seeker of an "honest man." The Cynics, which means "doglike," strove to live in conformity with nature and reason, not to be swayed by customs, norms, rules, money, ambition, and the pretensions of urban culture, which they publicly flouted and confronted "like dogs."
Their sarcasm was thus a corrective to the illusions and hubris of their fellow citizens, an exaggerated form of rebuke they inherited from Socratic nonconformity and deflationary questioning. There was more than hint of sarcasm in Socrates himself and even, at times, in Jesus. As Diogenes remarked: "A dog bites his enemies. I bite my friends to save them."
So there may be purposeful, even ethical mockery that takes the form of sarcasm as differentiated from insult and humiliation. The application depends on the power structure in which it is applied. As we say, a haughty rich man slipping on the banana peal is funny, a poor old man slipping on the same banana peal isn't. Proper applications of sarcasm should discomfort the overly comfortable.
With the important caveat that sarcasm can all too easily become a callow and unattractive habit, as well as a dangerous recourse of the political demagogue.