Music for two or more players at one keyboard began to come into prominence in the generation after J.S. Bach, as the piano -- with its longer keyboard -- began to displace the harpsichord as the "default" keyboard instrument in a well-equipped musical household. Bach's son Johann Christian contributed several sonatas to the four-hand piano repertoire. In the next generation, Mozart wrote a substantial quantity of exquisitely crafted and irresistibly appealing music for two pianists. His contemporary Haydn, for whatever reason, was much less prolific in this medium; and Haydn's sometime pupil Beethoven followed his teacher's example, contributing only a handful of early works to the four-hands literature.
Of these, the most substantial is the two-movement Sonata in D Major, Op. 6, composed and published in 1797. By this time, Beethoven had spent five years in the big city of Vienna after pulling up stakes from his hometown of Bonn, but was still building his reputation as a virtuoso pianist and composer. Thus it was necessary for him to supplement his income by teaching -- an activity which, by most accounts, he disliked and wasn't much good at, and which he abandoned entirely by about 1805.
Given its date, its relatively modest technical challenges, and the absence of documentation for any public performance, it is generally assumed that the D Major Sonata was composed as a teaching piece. Nonetheless, it foreshadows the composer's maturity in several respects -- for example, the main themes of both movements are ornamented when they reappear toward the end of the movement, rather than being played straight as Mozart and Haydn might have done.
Of the two movements, the opening allegro is the more energetic. Its vigorous opening motif -- three short repeated notes, followed by a single longer note at a lower pitch -- contrasts with a more sinuous, melodic secondary theme. In the central development section, the two themes are superimposed on each other with interesting results. The concluding movement, a genial rondo with the tempo marking moderato, is cast in a five-part ABACA form; the first or "B" episode is in the minor mode, while the second remains in the major and contrasts more gently with the main theme.
But the most striking omen of the mature Beethoven lies in that opening motif, innocuous as it may seem in this context. If you take that three-shorts-and-a-long figure, change it from major to minor mode, and speed it up, you have the opening theme of Beethoven's Fifth Symphony -- arguably the single most famous piece of classical music in the world.