Yesterday and today, the Church celebrates two great feasts of the communion of saints: All Saints and All Souls day. They're like two faces of the same coin. All of the saints are those who have gone before us and now rejoice in God. The holy souls are those who have passed from this life but are undergoing a purification before entering into the fullness of joy.
The Catholic Church teaches that by our prayers, especially through the Mass, we can help those who are being purified. This is the reason why we offer Mass intentions for the deceased. Purgatory is more of a state than a place, as Pope John Paul said a few years ago in his general audience on the subject. The doctrine of purgatory gives us a consoling message. If we die without having reached the degree of love that God calls us to, we can get there through God's own loving action in our souls. That's really what purgatory is all about: finally learning to love as God loves. And when we reach it, we'll pass into the happiness of heaven.