By the 1800s, snuff—powdered, snort-able tobacco—had become such a long-standing societal fixture in the UK and U.S. that phrases started popping up around the word itself. To beat to snuff, for instance, meant to best your opponent so thoroughly that you figuratively reduced them to powder. In high snuff, meanwhile, described someone in high spirits (maybe a nod to the buzz you’d get after using tobacco).
But the most prevailing example is probably up to snuff, which the Oxford English Dictionary defines as “knowing, sharp, not easily deceived,” and “up to the required or usual standard.” Unlike the aforementioned phrases, the connection between pulverized tobacco and being savvy or meeting requirements isn’t quite clear. On his World Wide Words blog, Michael Quinion suggests that it may have had to do with snuff’s largest user demographic: wealthy men “who would be able to appreciate the quality of snuff and distinguish between examples of different value.”
What we do know is that up to snuff had entered the British lexicon by 1807, when it appeared in a London newspaper—the earliest known written mention of the phrase, according to Merriam-Webster. Only fragments of the passage are legible: “ … asked a young lady if she would have a pinch of snuff, and on … in the negative, he facetiously observed … suppose you are up to snuff.”
It came up again in Hamlet Travestie: In Three Acts, an 1810 parody of Shakespeare’s Hamlet by British playwright John Poole. Rosencrantz and Guildenstern are explaining to the king that Hamlet won’t reveal why he’s been strangely disconsolate, and Guildenstern says “He won't be sounded; he knows well enough / The game we're after: Zooks, he's up to snuff.”
After the play’s conclusion, Poole added a commentary that he himself wrote in the voices of literary luminaries and Shakespearean scholars of eras past, including Alexander Pope, Samuel Johnson, George Steevens, and William Warburton. Though Poole-as-Warburton argues that up to snuff was referring to Hamlet’s ability to literally sniff out Rosencrantz and Guildenstern’s ulterior motive, Poole-as-Johnson asserts that it was likely being used in its “common acceptation” as a reference to Hamlet’s being “a knowing one.” Grose's Classical Dictionary of the Vulgar Tongue echoed Poole-as-Johnson’s understanding of the phrase in its 1823 edition, and so did Merriam-Webster in its 1864 dictionary.
As for how the idiom evolved to describe someone or something that meets standards, there’s no clear path—though it makes sense that someone considered knowing and astute would also be generally regarded as a person of merit.