This is one of the most widely quoted lines in all of English poetry and is usually used divorced from its context. Within the context of the poem, Keats is thinking very specifically about a Grecian urn, which depicts the day-to-day activities of people living thousands of years before Keats was writing. Keats is particularly impressed by the longevity of the piece: as an urn, it is intended to be beautiful, but it is also intended to showcase something of a society which has now vanished. In so doing, it prevents that society from ever vanishing completely for as long as the urn exists.
The existence of the urn, Keats says, serves to tell us that the most beautiful thing of all is "truth." It is beautiful because, even as the generations "waste" and pass away, the images on the urn survive to present a truthful snapshot of how things once were. Rather than trying to critically appreciate the art on the urn based upon technique or presentation, Keats's judgement here is that the mere fact of its continued existence, and what that is able to tell us, makes it beautiful. It is miraculous that something such as this, a piece of art, should have survived so long and now be able to offer an insight into the truth of a society which has since passed away.