Why did Krishna break the law of nature by giving life to a dead person?
Vaishampayana said, "Understanding that that weapon was thrown (into the wombs of the Pandava women) by Drona's son of sinful deeds, Hrishikesha, with a cheerful heart, said these words unto him: ‘A certain brahmana of pious vows, beholding Virata's daughter who is now daughter-in-law to Arjuna, while she was at Upaplavya, said, "While the Kuru line will become extinct, a son will be born to thee. This thy son for that reason, will be called by the name of Parikshit." The words of that pious man shall become true: the Pandavas shall have a son called Parikshit. Unto Govinda, that foremost one of the Satvata race, while he was saying these words, Drona's son, filled with wrath, replied, saying, ‘This, O Keshava, that thou sayest from thy partiality for the Pandavas, shall not happen. O thou of eyes like lotus-petals, my words cannot but be fulfilled. Uplifted by me, this weapon of mine shall fall on the foetus that is in the womb of Virata's daughter, upon that foetus which thou, O Krishna, art desirous of protecting.'
The holy one said, "The fall of this mighty weapon will not be fruitless. The foetus will die. But being dead, it will live again and have a long life! As regards thyself, all wise men know thee for a coward and a sinful wretch! Always engaged in sinful acts, thou art the slayer of children. For this reason, thou must have to bear the fruit of these thy sins. For 3,000 years thou shalt wander over this earth, without a companion and without being able to talk with anyone. Alone and without anybody by thy side, thou shalt wander through diverse countries, O wretch, thou shalt have no place in the midst of men. The stench of pus and blood shall emanate from thee, and inaccessible forests and dreary moors shall be thy abode! Thou shalt wander over the Earth, O thou of sinful soul, with the weight of all diseases on thee. ~Mahabharata: Sauptika Parva: Section 16
This was an example of boon deadlock where one brahmana gave a boon that a son will be born and another (Aswatthama) released brahmashira to kill the foetus itself so that son can't be born. Many instances like this are mentioned in the Is there any mention of boon deadlock in scriptures? post where solution was like this (first let the person die and then revive again to keep the truth of both the boons/curses/divyAstras).
Also, such acts were not considered against the nature. We have many instances (Resurrection stories in Hindu scriptures?) similar to this (when dead one's life was brought back):
Lord Shiva gave life to Ganesha after his head was severed (~Shiva Purana)
Lord Shiva gave life to Daksha after his head was severed (~Shiva Purana)
Sage Bhrigu gave life to his wife after her head was severed (~as discussed in this post)
Sage Bhrigu/Lorad Parshuram gave life to Jamadagni after his head was severed (~ as discussed in this post)
Each Pandava has one or more than one wife other than Draupadi and all of their sons were also killed in the war. But was it not possible for them to have more children again? What was the technical/medical/mythical/social problem for Pandavas to not reproduce more children?
Pandavas age was around 90 years at that time:
What was the age of all Pandavas during the Mahabharata war?
And this was during conjunction time of Dwapara and Kaliyuga, so human age was also not in thousands. It might have been possible to produce more children but it should be noted that Parikshit was their grand son so getting son was possible but but getting grand son was not possible (immediately) provided son was already dead.
And important thing why a baby must be killed without his fault. This was an inappropriate act by Ashwsthma at first place. So Parikshit didn't deserve death. He must have been saved. And the same was done. Else you might have asked today why Lord didn't save Parikshit?
Where can we find the description of how Maharaja Parikshith (as a baby) was saved by Sri Krishna?
Is there any mention of boon deadlock in scriptures?
Resurrection stories in Hindu scriptures?