In origin, I imagine that 'sarcasm' was intended to avoid direct abusive confrontation. It was, I suspect, used to gently point out to a 'superior' that their behaviour had not been good. The use of flattering titles when addressing such a 'superior' may be all that was needed to make such a member of the nobility realise that their behaviour had been less than wonderful.
"Oh, my gracious lord, how unfortunate that the enemy should choose a time to attack when thou hads't been sampling my humble offering of wine. Were thou not 'asleep', this cowardly enemy would not have killed my unworthy family, as thou would'st have ordered thy loyal troops to resist this attack."
The tone of voice would be as 'normal' as the utterer could manage. A direct assertion of the Noble's disgraceful behaviour would have probably ended up with the underling's incarceration.
The behaviour of several Australian politicians who use sarcasm as a blunt tool of aggression, a mode of bullying (often to avoid legitimate questions about their own performance, or merely to show how 'superior' they are), has no such excuse. P. Keating and P. Costello come to mind. It is uncivil, cowardly, and most unattractive to anyone listening.
This type of sarcasm has its origin in Melodrama, I guess, where the hero uses what Middle Class viewers regarded as 'refined language' to chastise a villain. It has all the subtlety of a pre-school student's retort to a fellow student. If it is delivered with even a modicum of skill, however, it has the capacity to deeply hurt a target. Neither of the politicians mentioned, in my view, ever displayed even a hint of skill, however.
The use of 'irony' (subtly different to sarcasm) can be a peaceful, even humorous, way of avoiding a noisy confrontation.
How does one handle the second, more contemporary, type of sarcasm? After a lot of thought, I suspect that the only way to 'handle' it in most situations is to simply pretend it hasn't happened. If this type of bully is allowed to use sarcasm to create a hurtful result, this mode of aggressive interaction will be used again and again. If a sarcastic statement is not responded to in a manner indicating one has been hurt, the aggressive one is likely to feel a level of humiliation.