In "The Rime of the Ancient Mariner," what has the protagonist done that needs forgiveness? Why is he sentenced to walk the Earth?
The mariner is doomed to walk the earth forever because he has been "won" in the game of dice by Life In Death. His fellow sailors were "won" by Death. So, they all die, and he is forced to live forever to tell the story of his experience in the hope that he can educate others to respect all of God's creations--all creatures great and small--in that his mistake will not be others' failure as well. With regard to the forgiveness, he has been forgiven. The Mariner is forgiven the minute he "blesses the sea snakes unware" and the albatross falls from his neck. At this moment in the poem, we know that the Mariner has learned his lesson and has gained the respect and forgiveness of the higher power (sometimes called God, sometimes spirits) mentioned repeatedly in the poem. The fact that the Mariner is able to focus on individuals who need to hear the story and he can put them in a trancelike condition tells us that there is a supernatural effect about this man and about his lesson learned. By listening to him, the wedding guest (who repeatedly says he is frightened of the Mariner--another sign of supernatural events) prevents his own demise and avoids a similar fate.
The mariner has been forgiven; his having to go around the world telling his story to those who need to hear it is more about penance, atoning for his sin of shooting the albatross and causing the deaths of the crew of the ship. Remember that the mariner realized that he had done grave wrong by shooting the albatross and he is spared death; however, his telling the story for the rest of his life is a reminder of that sin that he committed and a way that he must continue to atone for that sin.