In Mosiah 23 the people of Alma were living in righteousness for the most part. They had repented, and were humble before the Lord. Though they were in bondage, they understood they alone could not succeed in getting themselves out of this predicament. They had tried several times, and to no avail. They were a little dejected, but humbled and ready to rely on the Lord. He did not immediately release them, but allowed them to learn from their terrible trial for a bit longer. Once they are finally free, the Lord still does not let them have full relief. In verse 21and 22, we read "Nevertheless the Lord seeth fit to chasten his people; yea, he trieth their patience and their faith. Nevertheless—whosoever putteth his trust in him the same shall be lifted up at the last day. Yea, and thus it was with this people".
It is not always our fate to be blessed with riches and wealth and absence of trials. Sometimes those conditions can be a trial anyway, so we might just be looking at things too temporally. We are put through trials to test our patience and faith, just as we read before. If we submit to the Lord's will, and accept our lives with patience and faith, we are learning exactly what the Lord wants us to, and we can then progress, and work toward our salvation.