This is certainly not the only instance of what might seem to be an abrupt and morbid narrative detour in the course of Beowulf. There are probably several reasons for this;
- The most straightforward interpretation is that this is a reminder that all good things in mortal life are transient in the face of the inevitability of death. The sudden appearance of the theme in these lines may serve as a reminder that death, too, can be sudden and unnerving, and that one would do well to remember that it constantly lurks in the background.
- As an epic poem, Beowulf is concerned with large themes, such as mortality, glory, leadership and family. These kinds of stark contrasts between life and death are normal and common in this type of narrative.
Beowulf may have originally been an oral performance, and was therefore probably ritualized, formatted or otherwise imprinted with some form of inherited structure and content beyond the plot itself. It may have also been based on, or descended from, a pagan text, with Christian themes inserted later by other authors or translators. Since the text is only known from one source, we can only speculate as to which aspects of the story are more flexible than others, but it's possible that this was something "required" by the text for a reason unrelated to the plot, such as manipulating the tone or injecting religious commentary.
Personally, I think that the best reason for this juxtaposition of themes is to remind the audience that this story almost always comes back to destiny, which is rooted in mortality; how does one make the best of a life whose limits are unknown to us? The poet is not bringing up death in order to put a damper on the mood, but to level the tone and be the subtle, somber reminder not to become carried away with one's self. A warrior who fails to remember that he cannot escape his own mortality is, inevitably, not the sort of person who attains a great destiny, since such a destiny is almost always linked with selflessness.