As others have said, it's very situational, and it's best to take one's cues from one's SO.
I can't imagine any of my friends or family insulting my (hypothetical future) SO in a deliberate way, but honestly if they did, I would probably be so mad and shocked that I would say something right then and there. I guess I would feel justified doing it because they're my friends/family--the only way SO knows them is through me, so in a sense I would feel a bit responsible for their behavior towards SO. But if, afterward, SO asked that I not jump in should it happen again, I would try to respect that. (Okay, actually, I would not want to be around that person again if they were deliberately rude to my SO, so there wouldn't be another opportunity, at least with that person.)
If it was someone who was a stranger to both of us--like a fellow customer at a shop, or a server at a restaurant--I would still be quite angry, of course, but I would try to let my SO handle it. I'm sure they would see me glaring daggers in the background, though! If I were the one being insulted, I would rather nobody engage the crazy, and have both of us just try to ignore it and move on/away. Actually, what would be really helpful is if my SO could keep a clear head and suggest that we just leave or whatever, because I would be standing there getting angry and upset.