hmmm relationships are always tough... you can either try to be friends with both of them (which won't be particularly easy) or you can stick up for the one who thinks deserves it and there's a chance you might cause a small argument and you won't be as close to this friend... or maybe they will come to their senses and you guys will still be friends...
Or, you can kindly ask your friend to stop talking about that person because you don't think there's anything wrong with what they're laughing about and you could say that you are good friends with this person.
If it were me I would go for option three and kindly imply and if not ask them to stop bitching. ie: when your friend mentions her and starts taking the piss ultra casually say "well I like her, yeah she's really nice" if it doesn't stop then say something along the lines of "we're good friends actually and I don't think there is anything wrong with (whatever she's laughing about)" just make sure you aren't being mean because then your friend you are confronting will retaliate and might be argumentative back :P
Personally I hate bitching and when my friends do it I either don't pay attention or stick up for whoever they're bitching about in a gentle way... I rarely agree. so I hope this will help narrow down your options but just try not to be rash about anything and know when to step back and let things cool down between a friend.
Best wishes!
<3