The first time I ever heard this claim was years ago and I think it was when I read Ron Chernow's biography, "Washington". It's true but there is debate about whether or not he inoculated the whole army. He did, however, inoculate new recruits, and then quarantined them until they recovered. They were inoculated by making a small incision in the arm and then rubbing a bit of pus on the cut from an infected person. It nearly always resulted in the recruit contracting the disease, but in a milder form.
All the people I know who have been deployed to the sandbox since the Gulf War were given inoculations/vaccinations so often that some of them can't remember all of it. Some of them also had to stand near burn-offs during their deployments, inhaling mystery particles that messed them up. Soldiers have always had to put up with more of that kind of stuff than civilians.
In the colonies, Cotton Mather learned about the practice from on of his slaves and recommended it.
Smallpox killed about 30 percent of people, and left many survivors blind or scarred. Variolation cut the death rate to 10 percent.
Vaccination with cowpox derived vaccinia has less than one percent mortality.
Washington used variolation on new recruits because there was smallpox in nearby Boston and probably saved the revolution
Ironically the invasion of Canada failed due to smallpox, and many black slaves who joined the British to fight in exchange for freedom died of smallpox.