According to Wikipedia:
While the exact origins of the phrase are unknown, it is commonly believed to have been coined by Americans during World War II. Large numbers of American troops were stationed overseas for many months or years, and as time passed many of their wives or girlfriends decided to begin a relationship with a new man rather than wait for their old one to return.
As letters to servicemen from wives or girlfriends back home would typically contain affectionate language (such as "Dear Johnny", "My dearest John", or simply "Darling"), a serviceman receiving a note beginning with a curt "Dear John" would instantly be aware of the letter's purpose.
A writer in the Democrat and Chronicle of Rochester, NY, summed it up in August 1945:
"Dear John," the letter began. "I have found someone else whom I think the world of. I think the only way out is for us to get a divorce," it said. They usually began like that, those letters that told of infidelity on the part of the wives of servicemen... The men called them "Dear Johns".
Here's another source that concurs: