Schubert wrote this piano duet between January and March of 1828, the last year of his life, when he knew that he was dying. He dedicated it to his pupil Caroline Esterhazy, with whom he was in unrequited love.
Schubert and the German composer Franz Lachner gave the first performance in May 1828, but it was not published until after his death in the November at the age of 31. I find it almost unbearably haunting.
Here is the score: