All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
The purpose of Al-Mubaahalah is to discriminate the truthful from the liar. As regards the wisdom of including the women and children, Az-Zamakhshari clarified this as he said: “If you say: His call to Al-Mubaahalah was only to show who is the liar, whether it is him or his opponent. This matter is related to him and the one whom he considers to be a liar. So, why is it that the children and the women are included? I say: “This strengthens the indication that he has confidence in himself and that he is sure about his honesty, to the point that he dared to expose to it (the punishment) his beloved ones, his children and the people most dear to him......The children and women were especially mentioned because they are the dearest relatives and one’s heart is most attached to them, and perhaps a man would accept to be killed for their sake.”
It is for this reason that the Christians of Najran, about whom this verse was revealed, did not accept to make the Mubaahalah with the Prophet .
In case the Mubaahalah took place and misfortune befell the children, then this is a consequence of the disobedience of the parents, and this may happen. Al-Haytami said: “If you say: the children did not do anything wrong, then how is it that they were punished because of the faults of their parents, and they were avenged due to the sins of their ascendants?; then I will say: Because they are the followers of those ancestors and they existed because of them. Allaah Says (what means): {And the good land — its vegetation emerges by permission of its Lord; but that which is bad — nothing emerges except sparsely, with difficulty.}[Quran 7:58]"
However, the basic principle is that no person is punished due to the sins of others. Allaah Says (what means): {And every soul earns not [blame] except against itself, and no bearer of burdens will bear the burden of another.}[Quran 6:164]
Sulaymaan ibn ‘Amr ibn Al-Ahwas narrated that his father said: "I heard the Messenger of Allaah saying in the farewell Hajj: "No criminal commits a crime but he brings (the punishment for that) upon himself. No father can bring punishment upon his son by his crime, and no son can bring punishment upon his father
Hence, the children will not be punished on the Day of Resurrection due to the sins of their parents.
Allaah Knows best.