This is one of Beethoven's forty-three canons, which as a group comprise an odd corner of his output. Most are very brief and, on the surface, seem to have little to offer. Generally, they follow the pattern of two voices fashioned in strict imitation, delivering a text usually supplied by the composer. Yet, several canons do not follow this formula, and in fact break from it in a rather radical and slightly capricious way. This one, Ich war hier, Doktor (I was here, Doctor), is a so-called puzzle canon, a genre whose relationship to musical composition can be likened in many respects to the way chess problems relate to the actual game of chess.
Beethoven typically wrote his puzzle canons as a gift for a friend or acquaintance. He usually scored them for only one voice, leaving it for the recipient of the piece and associates to decide where the second or additional voices would enter. Depending on the work, there could be more than one solution to the puzzle, especially as multiple voices are added -- not all of Beethoven's canons were written for just two voices. Thus, of several possibly suitable solutions one could suggest for performance of a given canon, there may be no certainty which of them was the preference of the composer.
This canon came after a period of serious illness by Beethoven, which interrupted work on his Op. 132 String Quartet (A minor). The composer visited the house of Anton Braunhofer, his physician, on June 4, 1825, when the health crisis had passed. Doctor Braunhofer was not at home and the composer left a message, "Ich war hier, Doktor," which he then set to music and later presented to the physician.
It will come as no surprise that the music born of these circumstances is rather humorous. Willy Hess fashioned a version for four voices and there have been two-voice solutions, as well. Beethoven may have intended this work for just two, but Hess' rendition is humorous and quite effective. The composer's theme gently ascends, yet the voices seem to intone the words, "I was here, Doctor," as a complaint. It's quite amusing for its 30-second duration, but its value as pure music is obviously dubious.
One might see the random element in this kind of work as a forerunner to the aleatoric music of the twentieth century. The work was published posthumously.