"Merlin's beard, keep it down!"
-- Hagrid's reaction to Hermione's scream (OP20)
“Merlin’s Beard!” is a mild oath used to express surprise or exasperation – and is a form of swearing exclusive to the wizarding world.
It appeared most frequently during the events in OP. Arthur Weasley seemed quite fond of the phrase (OP7, OP9, OP24), and it was also spoken by Hagrid (OP20), Dumbledore (OP27) and Cornelius Fudge (OP36).
In HBP, Cornelius Fudge likely confused the Muggle Prime Minister when he included it their conversation about the then current crisis (HBP1). Professor Slughorn said it when he encountered Harry in the grounds of Hogwarts (HBP22) and also when surprised by Tom Riddle’s questions about horcruxes in the past (HBP23).
Newt Scamander blurted the phrase at the Central Park Zoo when a baboon stole his wand, and again at MACUSA Headquarters when he saw an image of the dead Senator Shaw floating around the room. The British Envoy at MACUSA asked him “What in the name of Merlin are you doing in New York?” (WFT).
Regarding the first occurence, although the date printed on the fourth Daily Prophet Newsletter (DP4) is 1 October 1999, the timeframe for those events was 1992-93. GF was not published until July 2000 and covered the school year of 1994-95.