See here the wisdom of God, who can make the worst things imaginable turn to the good of the saints.
The Lord made Joseph's prison a step to preferment. There was no way for Jonah to be saved, but by being swallowed up. God suffered the Egyptians to hate Israel and this was the means of their deliverance. The apostle Paul was bound with a chain and that chain was the means of enlarging the gospel.
God enriches by impoverishing; He causes the augmentation of grace by the diminution of an estate.
He frequently makes use of unjust men to do that which is just. He can reap His glory out of men's fury. Either the wicked shall do the evil that they intend or they shall do the good which they do not intend. God often helps when there is least hope, and saves His people in that way which they think will destroy. He made use of the high-priest's malice and Judas' treason to redeem the world.
Yet...we silly creatures will be taxing Providence, and calling the wisdom of God to the bar of reason. There is never a providence of God but has either mercy or a wonder in it. He makes the most adverse dispensations work for the good of His children!
--All Things for Good, Thomas Watson