What are indulgences and when and why were they used? I seem to recall that indulgences had something to do with Roman Catholics doing something to receive forgiveness of sins prior to committing the sins.

So, is that what indulgences were?  When did these begin and are they still practiced?  If not, when did they end and why?
A good introduction to indulgences can be found here. A more thorough explanation can be found in the Catholic Encyclopedia. I will try to extract a few basic points.


  To facilitate explanation, it may be well to state what an indulgence is not. It is not a permission to commit sin, nor a pardon of future sin; neither could be granted by any power. It is not the forgiveness of the guilt of sin; it supposes that the sin has already been forgiven. It is not an exemption from any law or duty, and much less from the obligation consequent on certain kinds of sin, e.g., restitution; on the contrary, it means a more complete payment of the debt which the sinner owes to God. It does not confer immunity from temptation or remove the possibility of subsequent lapses into sin. Least of all is an indulgence the purchase of a pardon which secures the buyer's salvation or releases the soul of another from Purgatory. The absurdity of such notions must be obvious to any one who forms a correct idea of what the Catholic Church really teaches on this subject.


In Catholic theology there are two kinds of punishment for sins The first is eternal punishment in which the sinner is separated from God forever. The price of this punishment has been paid for all Christians by Christ. There is however a 'temporal punishment' for sins committed by Christians, as a "repayment of debt" for the sin. This punishment is served in Purgatory for a certain amount of time, after death. Indulgences (which comes from the Latin for a debt repayment) are a way for the person to pay that debt in their earthly life. The punishment of the first kind is a part of almost all Christian theology. The punishment of the second kind is largely specific to Catholicism.


  In the Sacrament of Baptism not only is the guilt of sin remitted, but also all the penalties attached to sin. In the Sacrament of Penance the guilt of sin is removed, and with it the eternal punishment due to mortal sin; but there still remains the temporal punishment required by Divine justice, and this requirement must be fulfilled either in the present life or in the world to come, i.e., in Purgatory. An indulgence offers the penitent sinner the means of discharging this debt during his life on earth.


Most non-Catholics have encountered the concept only as an object against which the Reformers protested. However even then the protest was largely against the sale of indulgences, a matter which the church does and did consider an abuse.


  These measures show plainly that the Church long before the Reformation, not only recognized the existence of abuses, but also used her authority to correct them.
  In spite of all this, disorders continued and furnished the pretext for attacks directed against the doctrine itself, no less than against the practice of indulgences. Here, as in so many other matters, the love of money was the chief root of the evil: indulgences were employed by mercenary ecclesiastics as a means of pecuniary gain. 


Indulgences are very old, going back to at least the third century of the church. Indulgences are still granted today, though not in any form that would be familiar from a popular account of the Reformation. They are typically proclaimed for specific religious acts. For example in the Jubilee years 1983 and 2000 indulgences were proclaimed for those visiting certain shrines in Rome and other places.



cf. X. INDULGENCES | Catechism of the Catholic Church.