Wikipedia's article on indulgences says that indulgences in the Catholic Church, especially prior to Reformation, were granting people only the remission of punishment, but not the remission of guilt. It says that the guilt would only be remitted through Confession (Sacrament of Penance). Was Confession in those times a necessity that by all means was to follow after an indulgence was obtained? Would the obtained indulgence lose its power if Confession did not follow?
Without going to confession, one could not gain an plenary indulgence. However that is not required for gaining a partial indulgence.
To gain indulgences, whether plenary or partial, it is necessary that the faithful be in the state of grace at least at the time the indulgenced work is completed. - THE GIFT OF THE INDULGENCE
Indulgences are not feats of magic and in order to gain any indulgence certain rules must be met. It has been the constant teaching of the Church that mortal sins must be confessed in the Sacrament of Penance. Indulgences have never nor could not ever substitute this fact.
A plenary indulgence means that by the merits of Jesus Christ, the Blessed Virgin Mary and all the saints, the full remission of the temporal punishment due to sacramentally forgiven sins is obtained. The person becomes as if just baptized and would fly immediately to heaven if he died in that instant. A partial indulgence means that a portion of the temporal punishment due to forgiven sin is remitted. Partial indulgences are received either by doing some act to which a partial indulgence is attached (e.g. praying a partially indulgenced prayer), or by the incomplete fulfillment of the conditions attached to a plenary indulgence. - What is an Indulgence?
An indulgence does not forgive the guilt of sin, nor does it provide release from the eternal punishment associated with unforgiven mortal sins. The Catholic Church teaches that indulgences relieve only the temporal punishment resulting from the effect of sin (the effect of rejecting God the source of good), and that a person is still required to have his grave sins absolved, ordinarily through the sacrament of Confession, to receive salvation. Similarly, an indulgence is not a permit to commit sin, a pardon of future sin, nor a guarantee of salvation for oneself or for another. Ordinarily, forgiveness of mortal sins is obtained through Confession (i.e., penance or reconciliation).
It seems that from the very conception of indulgence, the Sacrament of Reconciliation was an integral part of the gaining of an indulgence. Only valid sacramentally confessed mortal sins can be forgiven by a confessor. No works (no matter how holy) can take the place of the need to confess one's sins to a priest.
The earliest record of a plenary indulgence was Pope Urban II's declaration at the Council of Clermont (1095) that he remitted all penance incurred by crusaders who had confessed their sins in the Sacrament of Penance, considering participation in the crusade equivalent to a complete penance.
The actual act of going to confession does not have to be on the same day as the day in which one has completed the indulgenced act. Contemporary norms say that it should be carried out 20 days before or after the indulgenced act is done. In days of old, it was 8 days (before or after).
It is appropriate, but not necessary, that the sacramental Confession and especially Holy Communion and the prayer for the Pope's intentions take place on the same day that the indulgenced work is performed; but it is sufficient that these sacred rites and prayers be carried out within several days (about 20) before or after the indulgenced act. - THE GIFT OF THE INDULGENCE