@Aron It's spoken by the dying or by those in the face of death. It's popular amongst cavalry leaders who might intone the poem to his company as they ride out to charge at an enemy position, though virtually anyone who might think they could/would die would utter this prayer to themselves.

It is meant to be a form of closure that not everything you want to do in life will be done, but everything you have done in life is what matters in the end.