Perhaps literal prisoners are the ones that can relate most to this. However, anyone living in a figurative prison of restriction can also appreciate this. These may include those who are suffering with physical limitations due to health and/or age. Also, anyone who feels helplessly, hopelessly trapped (imprisoned) in a relationship or situation that has them living less than an ideal life. Tolerating oppression, prejudice, discrimination, or profiling that pigeon-holes you is also part of this. When we are robbed even of dignity and worth, what can help us to hold on? As overly simplistic as it may sound, here are some points I have found of value:
1. Pray often. Remember that in God's eyes, each of us has value and is precious. Whatever we are going through, he can undo it. Even if we die within this lifetime, there is always the hope of the resurrection when times will be much better.
2. Work on your personal development and relationship both with your creator and others. Joseph (son of Jacob, administrator of Egypt's food-stuffs during an extended famine) was a prime example of this. Before being elevated to that high office, he endured being sold by his own jealous brothers, transported far from everyone he knew by his vagabond slave owners, resold in Egypt, falsely accused of attempting to rape the wife of his boss, thrown into a prison and waiting for years before anything happened to change the situation. Even though the apostle Paul lived hundreds of years later, his advice seemed to sum up what Joseph seemed to instinctively know. Paul wrote (at 1 Thessalonians 4:11) "make it YOUR aim to live quietly and to mind YOUR own business and work with YOUR hands..." Also look for the lessons that you can use in your own life as you read the Bible just as we are encouraged at Proverbs 4:7, "Wisdom is the prime thing. Acquire wisdom; and with all that you acquire, acquire understanding."
3. When (if) your situation does take a turn for the better, do not bitterly, vengefully try to get even or arrogantly feel that now you can treat others poorly. Take the advice God's word gives us at Micah 6:8, "He has told you, O earthling man, what is good. And what is Jehovah asking back from you but to exercise justice and to love kindness and to be modest in walking with your God?"
4. Ask not for positions of honor or prestige, but for the wisdom to live not only a godly life for yourself, but also to help others cope with their challenges. Strive to be modest and learn what true wisdom is. More than seeking acknowledgement from others, focus on approval from your God.
5. Find joy in little things--music, the flight of a bird, the beauty of a flower. If possible, take up a hobby BECAUSE it gives your mind something positive to focus on, some small thing to look forward to. Think how you can be an encouragement to others--seeing a smile on the face of someone that you said a kind word to, will also lift your spirits and make you feel a real sense of joy and worth.