What's he saying?
"Not marble, nor the gilded monuments / Of princes, shall outlive this powerful rhyme;"
Statues and monuments will not last as long as this poem;
"But you shall shine more bright in these contents / Than unswept stone, besmear'd with sluttish time."
And you will last longer, immortalized in this poem, than the stone statues and monuments, which will fade and become dusty over time.
"When wasteful war shall statues overturn, / And broils root out the work of masonry,"
War and other disturbances will destroy statues and monuments,
"Nor Mars his sword, nor war's quick fire shall burn / The living record of your memory."
But poetry, which memorializes you, cannot be destroyed by these means.
"'Gainst death, and all oblivious enmity / Shall you pace forth; your praise shall still find room"
You shall outlast death and all other forces that seek to destroy things
"Even in the eyes of all posterity / That wear this world out to the ending doom."
Even for future generations.
"So, till the judgment that yourself arise, / You live in this, and dwell in lovers' eyes."
So you will live in this poem until judgment day.
Why is he saying it?
Sonnet 55 builds on Horace's theme of poetry outlasting physical monuments to the dead: Exegi monumentum aere perennius / Regalique situ pyramidum altius ... / Non omnis moriar. This phrase translates to, "I have built a monument more lasting than bronze / And taller than the regal peak of the pyramids... / I shall never completely die.] In Horace's Ode 3.30, it is himself who will be immortalized by his poetry, but in the case of Sonnet 55, Shakespeare seeks to build a figurative monument to his beloved, the fair lord.
However, the fair lord is not described or revealed in anyway in this sonnet; instead, the sonnet just addresses the idea of immortality through verse. The final couplet addresses this problem with the assurance that it doesn't matter, since "You live in this, and dwell in lovers' eyes." It is enough that the fair lord lives in "lovers' eyes," or the eyes of the poet and presumably everyone else who sees him. The reference to judgment day in lines 12-13 also suggests that perhaps the identity of the fair lord will be revealed then.
This theme of immortality through verse is common in Shakespeare's sonnets. For example, in Sonnet 18, the speaker assures the fair lord that he will not die, "When in eternal lines to time thou growest." Sonnet 19 admits that Time will eventually destroy the fair lord by disfiguring him and killing him, but ends with a challenge: "Yet, do thy worst, old Time: despite thy wrong, / My love shall in my verse ever live young." Sonnet 65 bemoans that fleeting beauty stands no chance against the ravages of time, but hopes "That in black ink my love may still shine bright."
The ravages of time is a recurring theme in Shakespeare's sonnets; often it is addressed in terms of its unavoidable effect on beauty and youth, specifically that of the fair lord, but here its effects on statues and monuments is the focus. "Wasteful war," "broils," the sword of Mars (the god of war), and "war's quick fire" are seen as the chief causes of the destruction of statues and monuments, in addition to "sluttish time." Here, "sluttish" means lewd and whorish, and characterizes time as apathetic to the orderliness of the world.
Line 13 refers to "the judgment that yourself arise," or judgment day. In religious tradition, judgment day is the point at which all souls, even those that have been dead for a long time (including that of the fair lord) will "arise" to be judged by God. This day is also referred to as "the ending doom" in line 12; "posterity," or future generations, live in the world until that final day when everyone is judged. After that day, there is no further reason for immortalizing anyone in poetry.