From KnowYourMeme.com, emphasis mine:
One of the most popular facepalm images is one of Captain Jean-Luc Picard from Star Trek the Next Generation taken from the episode “Deja Q,” in which Picard is shown reacting to a stressful situation
(This was the first result for googling Picard facepalm btw.)
From Wikipedia:
"Deja Q" is the 13th episode of the third season of the American science fiction television series Star Trek: The Next Generation...
In this episode, as the crew of the starship Enterprise struggle to prevent a moon from falling out of orbit, their situation is further complicated by a visit from a powerful nemesis named "Q" (John de Lancie), who informs them that he has been stripped of all his powers and must live out a mortal life.
Here's a video:
In this scene, Q (a character that the rest of the crew finds very annoying) is explaining to the bridge crew that he has been stripped of his powers and is human now. Picard is reacting to this news with skepticism and annoyance, based on previous encounters with Q.