The issue of indulgences was central during the period of the Protestant Revolt in the 16th century. First, let's look at the biblical rationale for an indulgence, and then delve a bit into the history of the controversy.

The Catholic Church teaches that penance is the imposition of temporal punishment or penalties for sin (the “binding” or “retaining” referred to in Matthew 16:19; 18:18; and John 20:23). Likewise, indulgences are the remission or relaxation of these same temporal penalties, by virtue of the prayer and penitence (of various sorts) of others in the Church (“loosing” or “forgive” in the same passages).

The Church has the jurisdiction to mercifully dispense these accumulated merits to those who possess less merit (see 1 Corinthians 12:26). An indulgence is essentially the same as any benefit applied to a person due to the prayer of another. In both cases, one Christian is assisted by the loving act of someone else.

We have an express example of a temporal penance given and then relaxed (an indulgence), straight from the Apostle Paul. He imposed a penance on a man who had sinned (1 Corinthians 5:3-5). Later, he relaxed it:

2 Corinthians 2:6-8, 10-11 For such a one this punishment by the majority is enough; so you should rather turn to forgive and comfort him, or he may be overwhelmed by excessive sorrow. So I beg you to reaffirm your love for him . . . Any one whom you forgive, I also forgive . . . in the presence of Christ, to keep Satan from gaining the advantage over us; for we are not ignorant of his designs. 

St. Paul in his commands and exhortations to the Corinthians is in entire agreement with the Catholic tenets of penance and indulgences. He binds and looses. He forgives, and exhorts the Corinthian elders to forgive also, even though the offense was not committed against them personally. Clearly, St. Paul and the Corinthian elders were acting as God’s representatives in the matter of the forgiveness of sins and the remission of sin’s temporal penalties (an indulgence).

The Council of Trent forbade the selling of indulgences, since abuses had become scandalous in the preceding period, thus partially agreeing with Luther and the Protestants, while retaining the doctrine itself. 

This brings us back to the historical controversy, which was a central concern for Martin Luther, when he initiated what he regarded as a “reform” of the Catholic Church.

Johann Tetzel (1465-1519) was a German Dominican friar who became a focus in the passionate debate about indulgences and their abuse. It turns out that his teaching regarding indulgences for the living was perfectly in accord with Catholic teaching: it applied to those who had repented of and confessed their sins. Their temporal penance was then relaxed.

The problem with Tetzel's teaching (and where Luther and the Protestants had a point) had to do with indulgences for the dead. Luther, typically, equated Tetzel's abuse with the actual teaching of the Catholic Church. It was not. The great German Catholic historian of the papacy, Ludwig von Pastor (1854-1928) explained Tetzel's error:

As regards these there is no doubt that Tetzel did, according to what he considered his authoritative instructions, proclaim as Christian doctrine that nothing but an offering of money was required to gain the indulgence for the dead, without there being any question of contrition or confession.

He also taught, in accordance with the opinion then held, that an indulgence could be applied to any given soul with unfailing effect. Starting from this assumption, there is no doubt that his doctrine was virtually that of the well-known drastic proverb. ["As soon as a coin in the coffer rings / the soul from purgatory springs."] 

The Papal Bull of indulgence gave no sanction whatever to this proposition. It was a vague scholastic opinion, rejected by the Sorbonne in 1482, and again in 1518, and certainly not a doctrine of the Church, which was thus improperly put forward as dogmatic truth. The first among the theologians of the Roman court, Cardinal Cajetan, was the enemy of all such extravagances, . . .

(The History of the Popes, from the Close of the Middle Ages, Ralph Francis Kerr, editor, 1908, B. Herder, St. Louis, Volume 7 [available online], 347–348)

This abuse (which was not official Catholic teaching) was what Luther particularly attacked. Luther's 27th thesis: one of his Ninety-Five Theses posted on the Church door in Wittenberg, Germany on Oct. 31, 1517 (considered the beginning of the so-called “Protestant Reformation”) read: “They preach only human doctrines who say that as soon as the money clinks into the money chest, the soul flies out of purgatory.”

The Catholic Church agreed with Luther, then and now, regarding this particular aspect. Specific reforms of indulgences were passed at the Council of Trent. But long before that, Luther had already decided — as his thought progressed — that the entire doctrine of indulgences was untrue and unbiblical. He “threw the baby out with the bathwater”: as he did with so many other Catholic doctrines (like purgatory itself), which were long established in Sacred Tradition, and underwent development through the centuries.

Blessed Pope Paul VI clarified the doctrine in his document, Indulgentiarum Doctrina (Apostolic Constitution on Indulgences: Jan. 1, 1967), writing:

Although indulgences are in fact free gifts, nevertheless they are granted for the living as well as for the dead only on determined conditions. To acquire them, it is indeed required on the one hand that prescribed works be performed, and on the other that the faithful have the necessary dispositions, that is to say, that they love God, detest sin, place their trust in the merits of Christ and believe firmly in the great assistance they derive from the Communion of Saints. 

Pope Paul VI thus stressed that the pious disposition of the receiver of an indulgence is of foremost and primary importance (similar to the use of sacramentals, such as holy water).