For Aquinas, conscience is the act of applying our knowledge of good and evil to what we do (or might do). So in order to (naturally) know what is a good action or bad one, one needs to understand how things are naturally ordered by God -- primarily what human nature is and what things it needs and deserves. This order which dictates what is good or evil behaviour is called the Natural Law by Aquinas. God can and does also supernaturally reveal what is and is not in accordance with his will, e.g. the Ten Commandments and Christ's Two Great Commandments. One also needs to apply this knowledge to what one does, and so one needs to be free to act in accordance with what one knows to be the Divine order of things, or not. Our conscience is our realization that what we might do or have done is good or not, but it is not the actual doing or the choosing. On a technical note, for Aquinas conscience is the act of understanding what is right and wrong, though the name may be applied by extension to a habit or power of performing this act of understanding. The virtue of making correct judgments about right or wrong, i.e. appropriate exercises of conscience is called prudence.
The reason that this is important is that one cannot do the right thing if one does not know what the right thing is. So, if someone has problems with their conscience, it does not seem appropriate to blame them. Children do not have fully formed consciences, and do not always understand what the right thing to do is. If a child does wrong because he or she didn't know any better, or because he or she thought it was the right thing to do, we do not (or should not) blame and punish him or her. Aquinas therefore believes that not only is one excused from wrongdoing if one's conscience is in error, one also is bound to do the wrong thing if one's conscience tells one that it is the RIGHT thing to do. He also believes that one has a duty to have a well-formed conscience, one that