There are many people in our churches who feel that the only reason they are going through a trial is that God is punishing them for some sin they have committed in the past or some sin they are unwilling to confess. When we read the Old Testament, we see God punishing people for their sins and we sometimes think God does the same with us.
The truth is that God does us punish us for our sins. Isaiah writes, "Surely he has borne our griefs and carried our sorrows; yet we esteemed him stricken, smitten by God, and afflicted. But he was pierced for our transgressions; he was crushed for our iniquities; upon him was the chastisement that brought us peace, and with his wounds we are healed" (Isaiah 53:4-5). Isaiah wrote that the Messiah would take all the punishment of our sins on Him. So when Jesus was on the cross, He was taking the wrath of God on Him. Paul wrote that we are saved from the wrath of God (see Romans 5:9), and he also wrote in Romans 8:1, that anyone in Christ is not condemned. Jesus said in John 8:36, whoever the Son sets free, is free indeed. We are free from the bondage of sin and we are also free from the punishment due to us because of our sins.
Now we also must remember though God does not punish us for our sins, he does discipline us. The Bible says, "In your struggle against sin you have not yet resisted to the point of shedding your blood. And have you forgotten the exhortation that addresses you as sons? 'My son, do not regard lightly the discipline of the Lord, nor be weary when reproved by him. For the Lord disciplines the one he loves, and chastises every son whom he receives.' 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? If you are left without discipline, in which all have participated, then you are illegitimate children and not sons. Besides this, we have had earthly fathers who disciplined us and we respected them. Shall we not much more be subject to the Father of spirits and live? For they disciplined us for a short time as it seemed best to them, but he disciplines us for our good, that we may share his holiness. For the moment all discipline seems painful rather than pleasant, but later it yields the peaceful fruit of righteousness to those who have been trained by it" (Hebrews 12:4-11). Whenever we are disciplined by God, it is not punishment, but to correct us. Granted some of that discipline could be the consequences of our actions, but not it is not the same as punishment. If God were to punish you for your sins, you would have died from your first act of disobedience.
Notice the passage in Hebrews says that God disciplines those He loves and those who are not disciplined are not true sons of God. So if God is using some form of discipline you, though it might be unbearable at times, God is using that to conform you to the image of His Son. Sometimes, God's discipline could come to us by being convicted by something we read in the Bible. Paul told Timothy, "All Scripture is breathed out by God and profitable for teaching, for reproof, for correction, and for training in righteousness" (2 Timothy 3:16). One of the ways the Bible is used is to correct us, which is a form of God's discipline on us.
Remember, if you are going through some tough time, whether your fault or not, or you feel convicted by some sin in your life, that is the Father disciplining you to become more like Jesus. I know it may not seem that way at first, but over time, you will see that God's hand was on you the whole time. He promises never to abandon us even when we think we have abandon Him.