Despite the characteristic Scottish accent he used in the show, James Doohan was in fact born in Vancouver, Canada (via Today I found Out). In the buildup to the European Theater of World War II Doohan became an artilleryman in the Canadian army, earning the rank of Lieutenant. In 1944, he was one of the soldiers set to land at Juno Beach during the invasion of Normandy, as this was the only beach to be assaulted by the Canadian army, rather than the Americans or British.
After disembarking from their landing craft, Doohan himself killed two German snipers as the Canadian troops did their best to navigate a minefield. As the sun faded and the fighting continued, a Canadian machine gun mistakenly fired on Doohan (via The Vintage News). He was hit four times in the leg, once in the finger, and once in a cigarette case, which spared him an otherwise fatal chest wound. After his recovery Doohan became a pilot, flying light aircraft for the remainder of the war (via World War Wings).