Indulgences, under the doctrine of the Roman Catholic Church, are grants given to individuals which reduce the duration of one's stay in Purgatory. The purpose of Purgatory is to purify the person, after physical death, from minor sins and the residual of more serious ones previously committed in this life and forgiven. Once perfected, that person's soul is then given entrance into Heaven.
A person may seek an indulgence for a loved one who has passed away or for his own "temporal" (not "eternal," i.e. hell) punishment. A "plenary indulgence"—for all punishment due up to the time it is granted—may be obtained for the living or the dead, whether known or unknown.
While Sacramental Confession is needed for the forgiveness of serious ("mortal") sins, indulgences deal with the punishment that a soul is believed to require as a consequence having sinned. An indulgence cannot be seen as a replacement for confession, for obvious reasons.
Until the 1567 Council of Trent, indulgences could be bought for specific periods of time. However, while both these old-form indulgences, and those of our own day, use time-based terms to indicate the relative worth of the indulgences available, they don't mean "x number of days off Purgatory" as though time in the afterlife can be compared to time on Earth. The time-based terms meant that the indulgence remitted the same amount of temporal punishment as that much time spent in the performance of penance on Earth would. Thus, an indulgence of 300 days means that it remits the temporal punishment that 300 days of doing penance would.
In the Middle Ages, an indulgence was frequently sold and distributed by the Church in the form of a promissory note, much like paper currency. The attack by Martin Luther on the sale of indulgences was the action that began the Reformation.