Here's a little history of the song from Wikepedia:
Martin Rinkart was a Lutheran minister who came to Eilenburg, Saxony at the beginning of the Thirty Years' War. The walled city of Eilenburg became the refuge for political and military fugitives, but the result was overcrowding, and deadly pestilence and famine. Armies overran it three times. The Rinkart home was a refuge for the victims, even though he was often hard-pressed to provide for his own family. During the height of a severe plague in 1637, Rinkart was the only surviving pastor in Eilenburg, conducting as many as 50 funerals in a day. He performed more than 4000 funerals in that year, including that of his wife.