When after hundreds of years the LORD finally heard the prayers and cries of his people in Egypt and delivered them from slavery under Pharaoh, he led them into the desert where they suffered for another 40 or so years. And the people were not happy about it:
Then they said to Moses, “Was it because there were no graves in Egypt that you brought us to the desert to die? What have you done to us by bringing us out of Egypt?”—Exodus 14:11
But God had reasons for so testing His people:
“And you shall remember the whole way that the Lord your God has led you these forty years in the wilderness, that he might humble you, testing you to know what was in your heart, whether you would keep his commandments or not. And he humbled you and let you hunger and fed you with manna, which you did not know, nor did your fathers know, that he might make you know that man does not live by bread alone, but by every word that comes from the mouth of the Lord.” (ESV)
Jesus said to his disciples, “If any man would come after me, let him deny himself and take up his cross and follow me.”—Mt. 16:24
Hebrews 12:5-12. “My son, do not regard lightly the discipline of the Lord,
nor lose courage when you are punished by him.
6 For the Lord disciplines him whom he loves, and chastises every son whom he receives.”
7 It is for discipline that you have to endure. God is treating you as sons; for what son is there whom his father does not discipline? 8 If you are left without discipline, in which all have participated, then you are illegitimate children and not sons.
9 Besides this, we have had earthly fathers to discipline us and we respected them. Shall we not much more be subject to the Father of spirits and live? 10 For they disciplined us for a short time at their pleasure, but he disciplines us for our good, that we may share his holiness.
11 For the moment all discipline seems painful rather than pleasant; later it yields the peaceful fruit of righteousness to those who have been trained by it.
12 Therefore lift your drooping hands and strengthen your weak knees, 13 and make straight paths for your feet, so that what is lame may not be put out of joint but rather be healed.”
“Trust in the Lord with all your heart and lean not on your own understanding;
in all your ways submit to him,
and he will make your paths straight” —Proverbs 3:5-6