Is it true that God sometimes works in mysterious ways?
It would difficult to read the story of Joseph in the Bible and see how any of the ways in which he was so badly mistreated over about a 13-year time span, could have possibly been allowed by an all loving God.
Paul says in Romans 8:28, “And we know that all things work together for good to those who love God, to those who are the called according to His purpose.”
God actually used the trials Joseph endured to bring about much good … including saving the lives of his brothers who had hated him so much. Many years after they sold their younger brother into slavery because of their jealously towards him, Joseph said this to them in Genesis 50:20, “You intended to harm me, but God intended it all for good. He brought me to this position so I could save the lives of many people.”
So the answer is “Yes” that God sometimes works in very mysterious ways in our lives. Joseph’s example is a wonderful lesson for all of us, if we choose to recognize and trust that Jesus will in fact use each and every situation (especially the really hard stuff!) for our good.