I am 21 years old and I have a daughter who is about a year old. She is my world, but I was not married when I had her, and I am not married now. I am a believer, but I am also a believer that everything happens for a reason. I just want to know if I will be punished and how can I be forgiven?
Your sin was having sex without being married (I am assuming that the sex was consensual and not that you were raped). That is called fornication. "Do you not know that the unrighteous will not inherit the kingdom of God? Do not be deceived. Neither fornicators, nor idolaters, nor adulterers, nor homosexuals, nor sodomites, nor thieves, nor covetous, nor drunkards, nor revilers, nor extortioners will inherit the kingdom of God" (I Corinthians 6:9-10). Your daughter came as a result of that sin, but having your daughter was not a sin.
Punishment is not required for the forgiveness of sin. Punishment exists to make a person aware that they are in sin and need forgiveness.
Forgiveness of sin depends on where you are in your walk with God. All sins can be forgiven. The Corinthians, whom we quoted Paul's statement about, had committed similar sins to your own, but they changed. "And such were some of you. But you were washed, but you were sanctified, but you were justified in the name of the Lord Jesus and by the Spirit of our God" (I Corinthians 6:11). Even if you think you are saved, I would like you to read What Must I Do to be Saved? and What Saves a Person? Much of what is taught in denominations is not accurate and there are far too many people who think they are saved without doing all that God said must be done. If you are a Christian, forgiveness of sin merely requires you to admit your faults to God. "If we confess our sins, He is faithful and just to forgive us our sins and to cleanse us from all unrighteousness" (I John 1:9).