The killing of the albatross is a central element of Coleridge's poem. The "moral" of the poem, its lesson, is stated very overtly near the end: "He prayeth best, who loveth best / All things both great and small." That is, to be approved by God, one must love all of God's creatures. Respect for nature is the central theme of the poem.
The killing of the albatross sets in motion the "penance" that the mariner must do to pay for his sin. Part of what makes his sin so heinous is that there is no reason for him to shoot the bird. It is simply a random act of unkindness. When the bird first appears, the ship is stuck in the ice in its journey southward. After the sailors befriend the bird and feed it, the ship breaks through the ice, and the sailors believe the bird to have been a good omen or an agent of fortune. The wind blows them northward now, and the bird stays with them night and day. However, in the middle of this friendly cooperation between man and nature, the mariner shoots the albatross with his crossbow.
The other sailors condemn him at first, fearing he had killed the bird that made the breeze blow. Later they change their minds as the breeze keeps blowing; they agree the bird had actually "brought the fog and mist," so it was right to have slain it. However, soon they find themselves stuck in the doldrums, dying of thirst, and now believe the killing of the albatross to be the reason for their bad fortune. With this they hang the dead albatross around the mariner's neck.
Eventually, all the sailors except the mariner die, presumably because they have all disrespected nature by praising the mariner's senseless taking of animal life. The mariner himself, the worst sinner, is put through a fate worse than death as he endures the trials that Life-in-Death puts him through, and as he must live the rest of his life going around the world and telling his tale to the person who needs its lesson.
The climax of the tale occurs when the mariner views the beautiful water snakes and "a spring of love gushed from my heart, / And I blessed them unaware." At that point he is able to pray, and the carcass of the albatross magically drops off his neck. Interestingly, this scene reflects the original sin of the mariner, which was also "unaware." Just as he didn't know why he killed the albatross, he doesn't really know why he blesses the snakes. He is punished for his mindless action, and he is rewarded for his mindless love. It is ironically fitting, then, that, having condemned himself and redeemed himself apart from any overt intention, he must now live the rest of his life divorced from his own intention. "Since then, at an uncertain hour," he must pass from land to land in order to share his story with others. The hearers, like the wedding guest, become "sadder and ... wiser," not likely to commit a random act of disrespect toward nature.