The Midrash asks a burning question: even if the Egyptians deserved such a terrible plague, for their oppression of the Israelites, how had the other slaves sinned? There is another puzzle too; here the first-born of the slave girls are specified, while later on (12:29) it is "the first-born of the captive in the pit" – why the change? The commentators solve this puzzle neatly. This prophecy is addressed to Moses in the daytime, when the slaves are grinding at the millstones, while the plague itself "came to pass at midnight" when the slaves were confined to their subterranean sleeping quarters.
The question of justice is harder. The Mechilta of Rabbi Ishmael suggests that the other slaves used to rejoice at every decree of Pharaoh against the Israelites and cites Proverbs 17:5, "One who is glad at another's misfortune shall not go unpunished". The Mechilta of Rabbi Shimon bar Yochai goes further: they said: "We are content with our servitude as long as Israel is enslaved." Exodus Rabbah explains that when they asked a captive bound in prison, "Is it your desire to go forth, and that Israel be delivered?" the reply came, "We will never depart from here so that Israel too may not depart." That is why God judged them with the Egyptians.
It is a sad but common experience that victims of oppression do not always show solidarity with one another. If Muslims suffer, is that the Jews' problem? And should Muslims enduring Islamophobia care about Christians being persecuted? We comfort ourselves in our hardship with the thought that others suffer too and engage in competitive victimhood. This dog-in-the-manger game only prolongs suffering. If we can join with others who suffer discrimination and strive to raise everyone up into freedom, then not only can we achieve liberation, but bring a "mixed multitude" (see 12:38) up with us too.