The struggles throughout the Mariner's voyage, as he recounts them to the Wedding Guest, have been caused by his sin of senselessly killing the Albatross. In Part V, after his men have been killed, a "troop of angelic spirits" animated the corpses of the Mariner's dead crew and sailed on without a breeze:
Under the keel nine fathom deep,
From the land of mist and snow,
The spirit slid: an it was he
That made the ship to go. (377-80)
The ship stops and spirits have a discussion about the Mariner's penance. In lines 408-09, one spirit notes that the Mariner has done some penance but will have to do more. The description of his penance is described in Part VII.
In Part VI, the Mariner's ship is sent at high speeds by supernatural forces while the Mariner is in a trance. He awakens from the trance and the ship sails on more calmly. The angelic spirits leave the bodies of the dead sailors. Then the Mariner sees a Hermit on a boat.
In Part VII, the Mariner's ship sinks and he's saved by the Hermit. The Mariner asks the Hermit to "shrieve" him (to absolve or forgive him) for his sin. The Hermit tells the Mariner to explain himself. As the Mariner begins his tale, he feels a great agony that remains until he has finished his tale. This is his confession which will bring him absolution. However, this is not a one-time confession. The Mariner will continue to feel this same agony and it will not go away until he's traveled to a new land and retold his tale. This is his penance:
Since then, at an uncertain hour,
That agony returns:
And till my ghastly tale is told,
This heart within me burns.
I pass, like night, from land to land;
I have strange power of speech;
That moment that his face I see,
I know the man that must hear me:
To him my tale I teach. (582-90)
The Mariner's penance is to retell his tale as a way to absolve his own sins and to teach others not to make the same mistakes.