The phrase originally came out of the English fox hunting tradition where a rider was not granted the right to don the scarlet colored jackets, called “pinks”, until he demonstrated superior horsemanship and service to the hunt.
Being “in the pink” meant the rider had reached the pinnacle of achievement in the hunt.
The use of the phrase “in the pink” evolved to be used more broadly to mean “the very pinnacle of” something, but not necessarily the hunt during the 18th century.
This meaning of the phrase is seen in literature beginning in the mid-1700s and continuing throughout the 19th century. It isn’t until the early 20th century that we see the phrase being used with its current associations.
It is unclear how it transitioned into a phrase that is now specifically health-related, but possibly, as it came into use among those not familiar with the hunt, it was thought that “pink” referred to the rosy glow of the complexion that is indicative of good health.
In researching this phrase, I was especially interested in delving a bit deeper into learning why scarlet was the color of the jackets worn in the hunt. I found this explanation:
“Formerly no man might hunt even on his own estate until he had a license of free warren from the Crown. Consequently he merely hunted by the pleasure of the crown, taking part in what was an exclusively Royal sport by Royal permission. And for this Royal sport, he wore the Kings livery of scarlet.” — Michael J O’Shea, James Joyce and Heraldry (SUNY 1986, p. 69)
The same paper also sets straight the thinking that scarlet was the color worn so that the rider could easily be seen or identified on the fields:
“it is interesting to note the curious legend that the pink of the hunting field is not due to any optical advantage but to an entirely different reason.”