Sometimes the guilt is there but an inequitable sentencing or bizarre plea deals result in extreme sentences. Or mental or physical illness results in the effect of the sentence being harsher than is reasonable.
Sometimes the choice of friends or activities results in being on the fringe of illegal activities that suck us in to illegal activities our selves or to being unable to prove our actions were not contributory before, during or after the fact. The price for this is frequently pretty stunning.
Sometimes there is outright miscarriage of justice where an entirely wrong person is charged and/or convicted of a crime that they simply did not commit, either through intent by the guilty party to escape discovery, inadequate police work, overzealous prosecutors, political climate, poor representation or any combination thereof.
But, even as appeals and continuing investigations continue I think it is a mistake to encourage our loved ones to rely on human agencies to bring them peace. Please understand I am NOT saying that such avenues should be abandoned or injustice meekly accepted. But I believe that to keep the focus on the unfairness of the situation can actually cause additional damage to our loved one.
If instead you can model for them a calm belief that all things come to good to them that trust God* then they can not allow the injustice to be more damaging than it might be. Encourage them to get their GED and participate in any educational opportunities and classes because these things can carry good things through their release. Encourage them to read scripture, participate in Bible studies or programs from Prison Fellowship or KAIROS if available, and seek out mature mentors to learn from, because all these things will certainly help them both today and when they return to the free world whenever and however that might happen. And because even in jail or prison God has important work for them to do, work that will give them a sense of purpose, dignity and hope. And because even in jail or prison God's gifts of love, joy, hope, healing, wisdom, strength and self-control are conferred by God through our relationship with Him, and no one should live in the lie that they must wait for this relationship or that anyone but God alone provides access to that relationship.
So it is also for us who wait in the free world, long for the restoration of our loved one to us, rage against the unfairness of it all. We don't have to wait either for a relationship with the God who longs to comfort us, heal us and give us understanding and hope. Talk to God about these things now so you will not do without comfort for want of asking.
*And we know that in all things God works for the good of those who love him, who have been called according to his purpose. Romans 8:28