I just mean being in a state of mortal sin. Let me explain how one might be in such a state, and that may clear things up.
When God justifies man, He pours His Love into man’s heart through the Holy Spirit (see Romans 5:5). It is this Love - the very Love of God - which makes a person capable of entering Heaven. For this reason, St. Paul writes that a person with all the faith in the world “gains nothing” without love (See 1 Corinthians 13).
When a person sins mortally, it is a sin against - a rejection of - Love. That is what makes an act a mortal sin: it is completely incompatible with love. When a person makes a mistake, or doesn’t think something through properly, or does something on instinct, those can’t be rejections of Love. However, when one willingly commits murder, or beats someone, or fornicates (that is, uses a person for sexual pleasure without being fully and irrevocably committed to that person), or does any number of other things, knowing fully what they are doing, they are rejecting Love. Thus, the Love of God is lost. St. John writes a great deal about this in his first epistle; see chapter 4 particularly.
A person who has sinned against Love no longer has the Love of God in his soul, and thus cannot enter Heaven. Once this has happened, how does that person get it back? Ultimately, it comes from God. All justification comes from God completely freely. However, in order to receive any gift, a person must want it (this, consequently, is why we say Hope is necessary for salvation - Hope means to desire Heaven, and so obviously a person must desire Heaven if he is to receive it).
There are two ways in which a person may want the gift of God’s Love. The first is that he is afraid of going to Hell. If this is the only reason a person is sorry for an act, this is called imperfect contrition, because the person is sorry, but not perfectly - out of love for God - but only imperfectly - out of fear. In this case, a person must go to confession. God designed how salvation works so that even imperfect people can get to Heaven - and so in confession, God’s Love is once more poured into a person’s heart, where it will remain unless he rejects it again. Of course, if a person merely fears Hell without really having greater motives, then chances are that they will reject Love again sometime soon.
There is another way that a person may receive the gift of God’s Love. This is to be sorry not merely out of fear, but also out of Love for God - to be truly sorry for having offended God (and neighbor). Now, such a person may also be afraid of Hell - and probably would be - but he will also sorry simply for having hurt his Lord and neighbor. Here is the rub, though - the only way to Love God is to have God’s Love already! So, any person who is sorry for having offended God - we call this perfect contrition - is sorry because God has already put His Love back into his heart is already out of the state of mortal sin, because he already has God’s Love in his heart again.
What then, is the difference between the two? Why does one person have perfect contrition and another imperfect? Why does God grant to some that Love prior to confession and others must wait? Ultimately, it is a matter of the person’s free will. Ultimately, even the fear of Hell can only exist by a Grace of God. All contrition - whether imperfect or perfect - comes only by God’s Grace. A simple way of putting it is this: when a person is in mortal sin, God offers them two things: fear of Hell, and Love itself.
It is easier for a person to accept the fear of Hell; it doesn’t require any real self sacrifice, and so most people easily accept this Grace. The Love of God, however, requires a dying to self. To accept the Grace of the Love God means not merely to agree that the sin deserves punishment and to agree not to do it anymore, but requires that a person agree to surrender everything to God, because Love of God requires accepting anything He would ask of you. To accept the Grace of the Love of God requires a person to, essentially, say that his own desires don’t matter, but God’s do. Therefore, many people will accept the Grace of fear, but not the Grace of Love.
Now a person who has perfect contrition is still bound by God’s command to go to confession, and so one with perfect contrition always will, having died to self and submitted to do whatever God asks, even if they don’t personally want to. On top of this, we know that our hearts can deceive us, so going to confession makes sure we have God’s Love returned in case we perhaps thought we had perfect contrition but didn’t. This is another reason by sorrow for Love of God goes to confession - to not do so would to take the chance of not seeing God, and Love doesn’t take risks like that. Love also goes to confession to be forgiven by the Church on behalf of all the people that have been wounded by the sin.