Hi. I do not have a thorough understanding of the Torah, but I have come across something that puzzles me recently. The law says that a child must not be punished for the sins of his father, and yet during the exodus, the firstborn sons of Egypt were killed, for the sins of their fathers against the Jewish people. I understand that the law came after the exodus, but is this not a moral inconsistency on the part of G-d? Thank you in advance for answering this question, it’s much appreciated.
ב"ה Shalom This is really a very comprehensive question which has to do with G-d's judgment in our world, and it is definitely appropriate to deal with the night before Yom Kippur, and deserves a lot more that what I will write here. But I will touch upon some major points. The first and foremost meaning of the verse Devarim 24 "“The fathers shall not be put to death for the children and neither shall the children be put to death for the fathers” is the legal ramification that a father cannot cause the death of a child by his testimony in a court and neither can a son cause the death of a father by his testimony. (See Sanhendrin 27B, Sifrie Devarim 280,Rambam Sefer mitzvoth 287) So if we see if we follow the proper meaning of the verse we see there is no inconsistency at all. However, I will not hide from you, that our Rabbis (See Sanhendrin 27B) also understood the verse in the ethical sense, that G-d doesn't punish the children because of the sins of the father. ((רס"ג דברים כד טז; הרי"ף בתשובה, הובא בשו"ת הרשב"א אלף קפה, ובמיוחסות קכה; רד"ק ורלב"ג מלכים ב יד ו; רמב"ן במשפט החרם, ובהשגות על ספר המצות שורש ב; שו"ת הרשב"א ב רל; ריטב"א יבמות עט א; ר"ן סנהדרין כז ב), Therefore, they also asked how the above verse can be reconciled with another verse in the Torah which says " keeps in mind the iniquity of the fathers upon the children" (Shemot 34:7) ? The answer given is that the verse which finds the children accountable for the sins of the fathers is referring to a situation where the children adopt the actions of their ancestors as their own. If they do not behave like their ancestors, they are not punished for their ancestors’ sins. What we learn from the Talmud here is that the ethical rule that " Neither shall the children be put to death for the fathers” is not a rule without exceptions. The exceptions apply both in a Heavenly court and a human court. The exceptions are scattered in different places in the Tanach and the Talmud, and sometimes even small children as in the case of "Ir Hanidachat"- a condemned city due to idol worship. The Rambam in Hilchot Teshuva 6:1, writes explicitly that there are cases in which even small children are punished for the sins of their fathers. Therefore, as we see, it is recognized in the Talmud and followed by other scholars over the generations that there are cases, when even small children are punished for the sins of their fathers. Consequently, it is not inconsistent with G-d's judgement and so G-d in his infinite wisdom saw it right that all the first born children in Egypt be punished. I have seen some who have written homiletical explanations why the first born children deserved such a punishment, but I decided to suffice with this. All the best Gmar Chatimah Tova.