Literally it means maybe "just what they need". But it is supposed to bear an ironic meaning, I guess. Right?
It means "they deserve it" (of a bad thing), "they had it coming", "it serves them right".
This passage from "The Brothers Karamazov" by Dostoyevsky:
— Сумасшедший, ведь ты убил его! — крикнул Иван. — Так ему и надо! — задыхаясь, воскликнул Дмитрий.
in English translation reads:
‘Madman! You’ve killed him!’ cried Ivan. ‘Serve him right!’ shouted Dmitri breathlessly.