"And it came to pass at midnight" (Exodus 12:29) - that the night divided of itself. "the firstborn of Pharaoh" - who was (his son) a firstborn. "to the firstborn of the captive" (Exodus 12:29) - even the captives who were in their servitude. But if the Egyptians sinned, what did the captives sin? Rather, because they used to say, "let them be in our servitude and not go out" - therefore "to the firstborn of the captive." And all the more so the firstborn of the maidservant who is behind the millstones. For what reason? Because of the firstborn of the maidservant whom they were enslaving among them. And all the more so the firstborn of beast. And why the firstborn of beast? Because they had it as a god, as it is said, "Behold, we would sacrifice the abomination of the Egyptians, etc." (Exodus 8:22). Another interpretation: Why "the firstborn of the captive"? The Holy One, blessed be He, said: If the punishment comes upon the Egyptians alone, those wicked captives will say, "our gods have now awakened and have avenged our likeness."
Why the Firstborn of the Captive Died at Midnight in Egypt
Midrash Aggadah, Exodus 12:29
ויהי בחצי הלילה. שנתחלקה הלילה מאיליה: מבכר פרעה. שהיה (בנו) בכור: עד בכור השבי. אף השבויים שהיו בשעבודם, וכי אם מצריים חטאו השבויים מה חטאו, אלא שהיו אומרים יהו בשעבודנו ולא יצאו, לפיכך עד בכור השבי, וכל שכן בכור השפחה אשר אחר הרחים, בשביל מה, בשביל בכור השפחה שהיו משעבדים בהם, וכל שכן בכור בהמה, ולמה בכור בהמה, שהיו להם אלוה, שנאמר הן נזבח את תועבת מצרים וגו' (שמות ח כב): ד"א למה בכור השבי, אמר הקב"ה אם הפורענות בא על מצרים לבדם, אותם הרשעים השבויים יאמרו אלהותינו נתעוררו עכשו ותבעו דיוקנו שלנו: