“An apple a day keeps the doctor away”

“An apple a day keeps the doctor away” (or, to hedge bets a little, “An apple a day helps to keep the doctor away”) has been promoted by American apple organizations since almost 1900. The promotions usually occurred during Apple Day/Week/Month in October.
 
The rhyme “Eat an apple on going to bed, and you’ll keep the doctor from earning his bread” was popular in England and is first cited in print in 1866 (from Pembrokeshire, Wales). “And then as to onions, what of the proverb, ‘An onion a day keeps the doctor away?’” was printed in The Spectator (London, UK) on February 27, 1875. The now familiar rhyme of “An apple a day keeps the doctor away” was cited in Wales by at least 1887.
 
A popular joke version (with variations from at least 1903) is “An apple a day keeps the doctor away, but an onion a day keeps everybody away.” Other jokes include “An apple a day will keep anyone away, if thrown hard enough,” “Is it true that an apple a day keeps the doctor away, or is it just one of Granny’s myths?,” “Where’s the best place to hide from a doctor?”/“An apple orchard” and “Why are doctors so afraid of apples, anyway?” “An apple a day keeps the doctor away. But if the doctor is cute, forget the fruit” is a jocular extension to the rhyme.
 
   
(Oxford English Dictionary)
an apple a day keeps the doctor away and similar phrases.
1866 N. & Q. 24 Feb. 153/2 A Pembrokeshire proverb. Eat an apple on going to bed, And you’ll keep the doctor from earning his bread.
1898 19th Cent. Apr. 644 There is no food so palatable, so wholesome, as fruit: ‘An apple a day, no doctor to pay.’
1899 Youth’s Compan. 10 Aug. 398/3 An apple a day sends the doctor away.
1913 E. M. WRIGHT Rustic Speech xiv. 238 Ait a happle avore gwain to bed, An’ you’ll make the doctor beg his bread (Dev[on]); or as the more popular version runs: An apple a day Keeps the doctor away.
1922 S. LEWIS Babbit (1961) i. 13 Of course I eat an apple every eveningan apple a day keeps the doctor away.
1934 Washington Post 30 Oct. 4/4 Testimonials to the truthfulness of that old saw about an apple a day keeping the doctor away.
2006 Lincs. Echo (Nexis) 29 Aug. 13 An apple a day may keep the doctor away, but a glass of cider a day is even better for your health.
   
Google Books
24 February 1866, Notes and Queries, pg. 153:
A PEMBROKESHIRE PROVERB.—
“Eat an apple on going to bed,
And you’ll keep the doctor from earning his bread.”
JOHN PAVIN PHILLIPS. 
 
3 August 1870, Pomeroy’s Democrat (Chicago, IL), “Agricultural Noted from Central New York ” (Utica), pg. 3:
Who plants an apple tree makes provision against life’s rainy days, against loss of health, misfortune in business and old age; also, you will keep the doctor away from your children and yourself.
 
Google Books
February 1874, The Dublin University Magazine, ‘The Folk-Lore of British Plants,” pg. 194:
“Eat an apple on going to bed,
And you’ll keep the doctor from earning his bread,”
is a Pembrokeshire proverb, and a somewhat similar saying is current in many other places.
   
Google Books
27 February 1875, The Spectator (London, UK), “Current Literature,” pg. 282, col. 2:
The Management of Infancy and Childhood in Health and Disease. By Howard Barrett, M.R.C.S. (Routledge.)
(...)
And then as to onions, what of the proverb, “An onion a day keeps the doctor away?”
 
Google Books
Glossary of Words in Use in Cornwall:
West Cornwall

By Miss M. A. Courtney
East Cornwall
By Thomas Q. Couch
London: Published for the English Dialect Society by Trubner & Co.
1880
Pg. 63:
“Eat an apple going to bed,
Make the doctor beg his bread”
       
Newspapers.com
Welsh Newspapers Online
26 November 1887, Wrexham (Wales) Advertiser, “The Pomological Show,” pg. 5, col. 6:
He advocated the increased use of fruit, for he believed in the old saying, “An apple a day keeps the doctor away.”
 
Google Books
Our Viands:
Whence they come and how they are cooked

By Anne Walbank Buckland
London: Ward & Downey
1893
Pg. 177:
“An apple a day keeps the doctor away,” says the proverb, and there can be no doubt that in temperate climes the apple, from its excellent hygienic and keeping qualities, ranks first in usefulness.
     
Google Books
December 1893, The Chautauquan, pg. 345:
A not too ancient English maxim runs:
“To eat an apple going to bed
The doctor then must beg his bread.”
 
Newspapers.com
13 February 1896, Chicago (IL) Tribune, “The Fruit Stand Nuisance,” pg. 12, col. 4:
The proverb says: “An apple a day keeps the doctor away.”
 
Newspapers.com
2 April 1896, Barton County Democrat (Great Bend, KS), pg. 1, col. 1:
An old proverb says:—“An apple a day keeps the doctors away.”
 
Making of America
21 May 1898, The Living Age, pg. 547:
“An apple a day, no doctor to pay.”
 
10 August 1899, The Youth’s Companion (Boston, MA), “Apples,” pg. 398, col. 3:
Apple sayings are frequent, both in our country and in England, all of which testify in favor of the fruit. In the “west countree” there are four such: “An apple a day sends the doctor away,” is the first and briefest. Then follow, in order of their vigor, three more:
 
Apple in the morning,
Doctor’s warning.
 
Roast apple at night
Starved the doctor outright.
 
Eat an apple going to bed.
Knocked the doctor on the head.

 
A little less aggressive is one of the Midlands:
 
Three each day, sev’n days a week—
Rudy apple, ruddy cheek.

 
Google Books
22 December 1900, Gardeners’ Chronicle, pg. 457, col. 3:
AN Apple a day
Sends the doctor away.
Apple in the morning,
Doctor’s warning.
Roast Apple at night,
Starved the doctor outright.
Eat an Apple going to bed,
Knock the doctor on the head.
Canadian Horticulurist.
 
23 December 1900, Anaconda (MT) Standard, pg. 23, col. 5:
From the Pall Mall Gazette.
(...)
An old saying has it that “an apple a day keeps the doctor away,” and if so a bottle of good cider taken regularly at luncheon should make the medical profession superfluous.
 
Chronicling America
21 August 1905, Washington (DC) Times, “Fruit in the Menu,” pg. 7, col. 3:
Less bacon and more fruit during the hot weather is a good rule, and the old saying, “An apple a day keeps the doctor away” has, like many more old sayings, a good deal of common sense and wisdom in its jingle.