In 1863 the words of Voltaire were alluded to in a memoir by Lord William Pitt Lennox who described the hazing experienced by pupils at the Westminster School in England: "...of having a flogging, to encourage the others, as a Frenchman said of the execution of Admiral Byng."
The first known reference to the specific wording "...until morale improves" dates to a 1961 US Navy comic:
https://babel.hathitrust.org/cgi/pt?id=uc1.c2582589&seq=737
After that cartoon was published we see many different variations on the phase pop up such as, "The layoffs will continue until morale improves" from 1964.
The first reference to the specific phrase, "The beatings will continue until morale improves" is from a 1989 Usenet post on soc.culture.nordic:
https://www.usenetarchives.com/view.php?id=soc.culture.nordi...
It's almost certainly older than that though because it's said as if it were a common phrase by that point.
"... and all liberty is cancelled until morale improves."