Vern, is correct. In the earily Church after a penitant had confessed their sins, there were usually very harsh penances. You have heard of sack cloth and ashes, well try wearing one for a year as a penance. The Church then realizing that many people skipped confession to avoid these penances, decided that rather than sack cloth for a year they could say certain prayers or do certain things such as pilgrimages, service to the poor, etc, to attone for their sins. It also was required to have the form of the particular indulgence approved from the pope for it to be an actual indulgence. That is why you see things like 3 years indulgence after certain prayers, and it usually must be said on a certain date or after communion, etc. with other actions such as confession and communion along with prayer for the Pope.
In the time of Luther there were certain priests, not all of them, who were selling indulgences. This was a terrible offense and the Church itself condemned it well before Luther said a word. But, like today some priest decide to do their own will rather than what the Church teaches, thus those priests are guilty of giving scandal to members of the Body of Christ.
This was not Luthers only reason for the things he did but it was one of them.