The first one comes from the slaughter after the destruction of Jericho.
From John Calvin’s Commentary on Joshua 6:21
“The indiscriminate and promiscuous slaughter, making no distinction of age or sex, but including alike women and children, the aged and decrepit, might seem an inhuman massacre, had it not been executed by the command of God. But as he, in whose hands are life and death, had justly doomed those nations to destruction, this puts an end to all discussion. We may add, that they had been borne with for four hundred years, until their iniquity was complete. Who will now presume to complain of excessive rigor, after God had so long delayed to execute judgment? If any one object that children, at least, were still free from fault, it is easy to answer, that they perished justly, as the race was accursed and reprobated. Here then it ought always to be remembered, that it would have been barbarous and atrocious cruelty had the Israelites gratified their own lust and rage, in slaughtering mothers and their children, but that they are justly praised for their active piety and holy zeal, in executing the command of God, who was pleased in this way to purge the land of Canaan of the foul and loathsome defilement’s by which it had long been polluted.”
This second quote comes from the execution of the family of Achan.
From Calvin’s Commentary on Joshua 7:24
If any one is disturbed and offended by the severity of the punishment, he must always be brought back to this point, that though our reason dissent from the judgments of God, we must check our presumption by the curb of a pious modesty and soberness, and not disapprove whatever does not please us. It seems harsh, nay, barbarous and inhuman, that young children, without fault, should be hurried off to cruel execution, to be stoned and burned. That dumb animals should be treated in the same manner is not so strange, as they were created for the sake of men, and thus deservedly follow the fate of their owners. Everything, therefore, which Achan possessed perished with him as an accessory, but still it seems a cruel vengeance to stone and burn children for the crime of their father; and here God publicly inflicts punishment on children for the sake of their parents, contrary to what he declares by Ezekiel. But how it is that he destroys no one who is innocent, and visits the sins of fathers upon children, I briefly explained when speaking of the common destruction of the city of Jericho, and the promiscuous slaughter of all ages. The infants and children who then perished by the sword we bewail as unworthily slain, as they had no apparent fault; but if we consider how much more deeply divine knowledge penetrates than human intellect can possibly do, we will rather acquiesce in his decree, than hurry ourselves to a precipice by giving way to presumption and extravagant pride. It was certainly not owing to reckless hatred that the sons of Achan were pitilessly slain. Not only were they the creatures of God’s hand, but circumcision, the infallible symbol of adoption, was engraved on their flesh; and yet he adjudges them to death. What here remains for us, but to acknowledge our weakness and submit to his incomprehensible counsel? It may be that death proved to them a medicine; but if they were reprobate, then condemnation could not be premature.
It may be added, that the life which God has given he may take away as often as pleases him, not more by disease than by any other mode. A wild beast seizes an infant and tears it to pieces; a serpent destroys another by its venomous bite; one falls into the water, another into the fire, a third is overlain by a nurse, a fourth is crushed by a falling stone; nay, some are not even permitted to open their eyes on the light. It is certain that none of all these deaths happens except by the will of God. But who will presume to call his procedure in this respect in question? Were any man so insane as to do so, what would it avail? We must hold, indeed, that none perish by his command but those whom he had doomed to death. From the enumeration of Achan’s oxen, asses, and sheep, we gather that he was sufficiently rich, and that therefore it was not poverty that urged him to the crime. It must therefore be regarded as a proof of his insatiable cupidity, that he coveted stolen articles, not for use but for luxury.

