He reinstated Jewish observance and ensured that Pesach would be kept so correctly that the author of the Second Book of Chronicles (in chapters 34 and 35) could comment, “No Passover like this had been celebrated in Israel since the days of the Prophet Samuel; none of the kings of Israel had kept such a Passover as Josiah kept”.
But ironically, in contrast to the first Pesach when Egypt suffered a defeat, soon after Pesach Josiah went to war with Egypt and this time Egypt prevailed and Josiah was killed.
It sounds like a case of God letting a good man meet an unfair destiny, but this is not the whole story. His religosity did not go with political judgment.
The Egyptian king had urged him not to get involved. Egypt was leagued with Assyria against Babylonia and warned Josiah that if he mixed in he was likely to suffer; indeed it would bring upon his head the wrath of the very God whom he so ardently worshipped.
Why then did Josiah proceed with his war? Was it that he was convinced that God would be on his side and that he could not possibly lose? He possibly also had a pious dream of being able, despite the passing so many centuries, to avenge the persecution which Egypt had brought upon the Hebrew people.
It seems that we have here a case of genuine piety that led to arrogance.