Let's take a look at this concept through the lens of Joseph's story. If this concept is true, then God meant for Joseph to be sold into slavery in order to punish him for sin, or develop his character and turn him into a great leader, or even just to get him to Egypt from his homeland.
First, if all God wanted was to get Joseph from Canaan to Egypt, God could have done that any number of ways without putting Joseph through turmoil and suffering.
Second, Joseph's suffering helped to develop his character and abilities as a leader, but God is not the one who sold him into slavery, or falsely accused him, or put him in prison. People did that, not God.
Third, clearly God was with Joseph throughout this time. Genesis 39:2-3 tell us that God was with Joseph in Potiphar's house and that Potiphar recognized this fact and that Joseph was a blessing to him. In Genesis 39:21, it clearly says that God was with Joseph in prison where he rose to a leadership position and he had favor with the warden. When Joseph went to work for Pharaoh, it became obvious that God had raised him to that position to save Egypt from the famine. God was continually blessing Joseph, not punishing him.
Finally, Joseph himself recognized that what his brothers had done to him was not the work of God. "You meant evil against me; but God has used it for good, to bring it about that many people should be kept alive," Joseph tells his brothers after they are reconciled (Genesis 50:20). The evil, the slavery, the imprisonment were not God's doing. As with Joseph, God is with us in our trials, with us in our suffering.
For reflection: How has God been with me in my trials? For what problems am I blaming God?
Let us pray. If you, O Lord, kept a record of sins, who could stand? But with you there is forgiveness