One of the dominant metaphors I find in the Old Testament is the wilderness and its purpose. Between bondage and the promised land very often lies the wilderness. There we are stripped of our natural strength and forced to rely on His. The comforts are gone, there is only the cloud and the fire to lead, and daily bread.
It's where our faith is stretched, exercised and fed, and where it grows - if we let it. Too many of the Israelites would not let it, and were forced to spend far more time wandering the desert than God had intended. So the challenge to us is to believe in the God who calls out of bondage and to Himself, even when the going gets tough. If you focus on God and believe in His good hand in your life (Heb. 11:6), and not on man or your circumstances or limitations, you will grow in grace and knowledge of our Lord.
Joseph had his dungeon, David had his flight from Saul, but then both were elevated to high positions. 1Cor 10 is clear that all these things have been given as examples to us, lest we lose heart. If you stay faithful in the wilderness, you will see the promised land. The key is to focus on God and His infinite supply of grace, not on the difficulties.
One book you might be interested in is Prison to Praise, by Merlin Carouthers. When he started praising God in his trials, and for the good the trials were going to bring (Romans 8:28), he found the power to overcome and lead a victorious life.
In the Word, Philippians 3 and 4 say a similar thing. Chapter 3 is about forgetting what went before, and pressing on to the high call of God in Christ Jesus. Then chapter 4 tells us to rejoice in all things, and it will be a protection for our hearts. As Nehemiah says "the joy of the Lord is our strength".