While it might appear that Deuteronomy 28 supports a prosperity gospel, the covenant structure makes clear that this is not the case. God longs to bless all His faithful people, and the curses definitely come as a result of disobedience. However, many of the curses are tied to the natural consequences of sin. Thus, it is usually not that God ordains such punishment, but that those who choose sin often bring it on themselves. It is similar to the blessings; God’s laws are intended to bring health and peace, so when they are followed, the natural consequences are often positive.
However, the curses are also connected to the time that Israel spent in the wilderness, indicating that the people understood them as connected to their times of rebellion in the past. If there are no consequences for wrongdoing to encourage people to come back to God, as sinners we will go on sinning rather than realizing we are going down the wrong path. The curses are also similar to many of the plagues in Egypt, and Deuteronomy 28 even specifically mentions the plagues as one of the curses (v. 21). God was also seeking to bring the Egyptians to repentance, and many of them did end up joining Israel.
Moses carefully connects some of the curses also to what Job experiences as an innocent sufferer when Satan attacks him in the cosmic conflict with God. This makes clear that not all suffering is a punishment or part of the curses. Sometimes it does not make sense to us why we suffer. Job wrestled with God, and he did not understand until the end that it was bringing him a much bigger picture of the great controversy, and that it was Satan bringing the evil upon him, not God.
As humans viewing the world through our limited perspective, we feel that because God is all powerful, He should be able to stop suffering and pain from coming to His faithful people. But it is not that simple. Suffering can come from many sources: sin, our choices, natural disasters, evil people, Satan; or it can simply be part of the great controversy that draws us closer to God and makes us long even more for heaven. It is not always possible to know the reasons for our suffering, but we can trust God through it, and know that He longs to bless us, and will do so ultimately for eternity in heaven if we stay true to Him.