The 17-year-old was trailing Kyle Edmund 6-3, 6-4 ,2-1 and had just had his serve broken in the third set when he smashed a ball in anger that struck Gabas.
It was clearly not intentional from the Wimbledon junior champion but, with Gabas in obvious pain, tie referee Brian Earley had no choice but to halt the match and leave Britain the victors.
There were boos from the crowd at the TD Place Arena, who had earlier roared Vasek Pospisil to a 7-6 (7/3), 6-4, 3-6, 7-6 (7/5) victory over Dan Evans that set up the deciding rubber.
An emotional Shapovalov, who was playing in only his second Davis Cup tie, said: “I feel incredibly ashamed and embarrassed and I just feel awful for letting my team down, for letting my country down, for acting in a way that I would never want to act.
£I can promise that’s the last time I will do anything like that. I’m going to learn from this and try to move past it.”
The International Tennis Federation announced Gabas had bruising and swelling to his left eye and had been sent to Ottawa General Hospital for a precautionary evaluation.
Shapovalov must now wait to see what punishment he faces. Earley is likely to issue a swift fine of $12,000 (£9,600), but the International Tennis Federation could increase that and/or hand Shapovalov a ban.
The incident brought back memories of the 2012 final at Queen’s Club, when David Nalbandian was defaulted for kicking an advertising hoarding against the leg of a line judge.
Tim Henman, meanwhile, was defaulted at Wimbledon in 1995 after striking a ball girl with a ball hit in anger.
Canada captain Martin Laurendeau accepted the decision was the only possible course of action but said he would have no qualms about picking Shapovalov in the future.
He said: “This is the biggest venue we’ve ever played in and, of all the cubic footage out there, the ball found its way into the umpire’s eye. It definitely wasn’t planned and it’s unfortunate.
“Hopefully this makes Denis a stronger person, a better player but a better person, and he’s already a great kid.’’
It was certainly not the way Britain wanted the tie to be decided as they move through to a quarter-final in France in April.
Captain Leon Smith said: “It’s a shame. I think we’re all pretty surprised at what just happened.
“I thought Kyle was terrific and it would have been nice for him to get over the line with a straight-sets win, which it was heading for, and a great performance.
“To finish like that, I feel sorry for Denis. He’s learned a harsh lesson. The most important thing is the umpire’s okay because that can be really, really dangerous.”
Smith said he had no inkling yet whether Andy Murray might play against France, where Britain would surely need their talisman to have a chance of winning.