In Shakespeare's Sonnet 18 ("Shall I compare thee to a summer's day"), the poet is comparing the subject of the poem with nature.
Though the summer is a beautiful time, the object of the poet's praise is even more "lovely and more temperate." Unfortunately, the winds wreak havoc with the gentle blossoms that bloomed in the spring ("May"). And in the summer, the sun can sometimes be terrible fierce ("too hot the eye of heaven shines"). He goes on to write that there is always an eventual decline in nature, with the passing of summer. So there is the question, "Shall I compare thee...?"
The pivotal point of the poem rests on the first word of the ninth line: "But..." Shakespeare summarizes an idea in the first two quatrains (four-line stanzas), but then shifts his focus in the first line of the third quatrain. In this case, he is saying that for all that happens in terms of nature and the summer, the object of his praise will NOT follow the same path: "...thy eternal summer shall not fade," even as time passes, even when death comes.
The couplet is used to draw the sonnet to its conclusion, but to present a summary of Shakespeare's thought: as long as there are people left to read this sonnet, the beauty and life of this person will be immortalized.
Whereas the beginning eight lines speak literally of a day in summer, the third quatrain becomes more figurative, metaphorical. The beauty of the poet's subject will not fade (literally, it will) or be less "fair;" death will not be a threat (though literally, it will), when this person looks towards dying and eternity. In a literal sense, the ravages of time will leave their mark, and death will come.
However the rhyming couplet works because Shakespeare (or the speaker) is saying that in the sonnet, time will not pass, and the object of the poem will be immortal, as if he or she were frozen in time at that very moment.