What's he saying?
"Those hours, that with gentle work did frame / The lovely gaze where every eye doth dwell,"
Time passed slowly while you were young and everyone loved to look at you,
"Will play the tyrants to the very same / And that unfair which fairly doth excel;"
But it will overtake you;
"For never-resting time leads summer on / To hideous winter, and confounds him there;"
As summer must give way to winter;
"Sap checked with frost, and lusty leaves quite gone, / Beauty o'er-snowed and bareness every where:"
And will become transformed with age:
"Then were not summer's distillation left, / A liquid prisoner pent in walls of glass,"
Then, if there weren't a bit of youth left hidden behind the appearance of old age,
"Beauty's effect with beauty were bereft, / Nor it, nor no remembrance what it was:"
The effect your beauty once had would be completely forgotten:
"But flowers distill'd, though they with winter meet, / Leese but their show; their substance still lives sweet."
But though your outward appearance changes, the essence of what you are remains beautiful.
Why is he saying it?
Sonnet 5 is one of the "fair lord sonnets," one of the first 126 of Shakespeare's sonnets, which are either addressed directly to or written about the effect of a young and strikingly beautiful man. It is also one of the "procreation sonnets," which focus on the fair lord's responsibility to have a child so that his beauty might be passed on for future generations to appreciate. In this case, the fair lord is not being spoken to directly, but rather hinted at in the extended metaphor.
In this sonnet, the fair lord is not mentioned directly; it is about aging in general. The extended metaphor of seasons is used to compare the process of a human growing old with the coming of winter. This metaphor is clear in line 8, "Beauty o'er-snowed and bareness every where," where "o'er-snowed" means covered in snow, or white hair, and "bareness" refers to the bare body and head of an old man.
Time is personified in Sonnet 5, as is the case in many of the procreation sonnets. First it is referred to as "those hours," in line 1, which, though at first gentle in youth, will become "tyrants" in old-age. Those tyrants will make the young lord ugly: "unfair" is used as a verb to mean the undoing of fairness. Lines 5-6, "For never-resting time leads summer on / To hideous winter, and confounds him there;" personify time as malicious, tricking summer into becoming winter and then destroying it.
"Summer's distillation" in line 9 refers to the process of the distillation of perfume from flowers, such as roses. This perfume is personified in line 10 as, "A liquid prisoner pent in walls of glass." The "walls of glass" are the vial in which the perfume would be stored. This perfume is the essence of the flower that was so beautiful in the spring, and in its preservation the flower's "substance still lives sweet."
Sonnet 6, which is a continuation of Sonnet 5, addresses the young lord directly. Paired with Sonnet 6, the meaning of Sonnet 5 as part of the procreation sonnet series is clear. In line 3 of Sonnet 6, the speaker urges the young man to "Make sweet some vial," referring to the vial in which a perfume would be stored. The speaker calls upon the fair lord to procreate in the first two lines of Sonnet 6: "Then let not winter's ragged hand deface / In thee thy summer, ere thou be distilled:" continuing the metaphor from Sonnet 5. The young lord must have children before "winter's ragged hand" can take his youth from him.