Bottom note box. - Meanings and Origins of Phrases | If you're interested in animals, feel free to check out the animal phrases list!

Something that is hard to accept.
In the later half of the 17th century, it appears this phrase first started out simply as "a pill to swallow," and then afterwards the adjectives "hard" and "bitter" were added to the front of it. For example, an English poet from the 17th century, John Dryden, published a work of his in 1668 called Essay of Dramatic Peosy. He wrote down the expression without those adjectives:

    "We cannot read a verse of Cleveland's without making a face at it, as if every word were a Pill to 
     swallow: he gives us many times a hard Nut to break our Teeth, without a Kernal for our pains."

Later, as far as I can tell, the word 'bitter' was added to the phrase. The earliest example I could find of this is from a French historian named Mr. Rapin Thoyras. In one of his written works from 1736, it reads:

    "This event, which happened the 7th of September, N.S. was immediately follow'd by the relieving of 
     time after, with the total explulsion of the French out of all Italy; a bitter pill to swallow."

As for the common form of the idiom that's heard today, "a hard pill to swallow," the earliest I could find this phrase in writing is in the early 19th century. An example of that can be seen in the Morning Journal newspaper from 1829, which reads:

    "That they will prove a hard pill for Turkey to swallow is to be expected, unless, indeed, some decided 
     friend has recently sprung up, who will not allow Turkey to be so crippled as to make her fall an easy 
     prey next time she is attacked."
Note: The definitions for phrases and sayings can be found with ease, but finding the origins of phrases proves far more challenging. Looking back through history, it's tough to find the place or person in which a phrase has its roots. We are limited to what can be found in writings, such as books, poems, newspapers, and plays. Often times, phrases will be quoted from century old newspapers, or from plays that were done in the 17th century by playwrights like William Shakespeare.

The phrases that are quoted are likely already commonly known, and have their origins elsewhere. For instance, just because an idiom shows up in a newspaper from 1850, does not mean the idiom originated from that newspaper. However, what that does tell you, is that the phrase was being used since 1850, so its origins are at least more than 150 years old.
* It was a hard pill for Jason to swallow when he realized his body's build was no longer as slender as it was in his twenties.
The meaning of this phrase.
The origins of this idiom.
Popular Idiom and Common Phrases, The Meaning and Origins of Expressions > H-Letter Sayings
Phrases and Idioms