Instead Condit will face Johny (Bigg Rigg) Hendricks on the March 16 card at Montreal's Bell Centre.
Hendricks had been slated to meet Jake (The Juggernaut) Ellenberger on the same show. Ellenberger (28-6) will now face former Strikeforce champion Nate (The Great) Marquardt.
"Unfortunately late last week during a training session, Rory suffered a severe neck and back strain," MacDonald's manager Lex McMahon said in a statement Monday night. "Rory is in a great deal of pain and has a very limited range of motion in his neck.
"Rory consulted a doctor and was advised that he will need to take three to four weeks off from training while he rehabs the injury. Rory is very upset that he will not be able to face Carlos Condit at UFC 158, but is looking forward to getting back to training as soon as possible and fighting the UFC's top competition."
The withdrawal is a blow to the 23-year-old Canadian who had campaigned to fight Condit.
The New Mexico-based Condit (28-6) handed MacDonald (14-1) the only loss of his pro career at UFC 115 in Vancouver in June 2010.
MacDonald started strong but faded and the fight was stopped with just seven seconds remaining. Viewers may disagree but MacDonald says he was humiliated.
"Because I was just laying there getting beaten on," he said in December. "My face looked like I was a guy from 'The Goonies' after. I was embarrassed, I was embarrassed about my performance and how I held myself. It did a lot of damage and I don't think I've been the same person since. So I want to get that back."
He moved to Montreal from Kelowna, B.C., after the loss, to train with coach Firas Zahabi, welterweight champion Georges St-Pierre and other elite fighters at the Tristar Gym.
MacDonald has won four straight since. And he had momentum on his side after dominating former champion B.J. Penn on Dec. 8 in Seattle in a fight that was postponed for almost two months after the Canadian suffered a bad cut in training.
Condit, meanwhile, is coming off a loss to St-Pierre, who meets Nick Diaz in the main event of UFC 158.
"While I was disappointed to hear that Rory MacDonald is injured, I am glad that the UFC was able to find a strong replacement for the fight in Johny Hendricks," said Condit in a statement.
"He is one of the toughest welterweights in the world, and has quickly risen up the ladder in our division. We are similar in that we like to stay active and aggressive in our fights, so this should be a great fight for the fans to watch."
Hendricks had complained that he, and not Diaz, deserved the title shot.
The hard-hitting Hendricks has won five straight, with impressive finishes of Martin (The Hitman) Kampmann and Jon Fitch.
But the UFC argued that GSP-Diaz was the fight people wanted to see.
A win over Condit would have vaulted MacDonald into title contention, although that might have been a problem given he trains with St-Pierre.
But with MacDonald temporarily out of the picture, Hendricks can reinforce his claim to being the No. 1 contender at 170 pounds with a victory over Condit.
Ellenberger still gets a chance to leap up the welterweight ranks by disposing of Marquardt (35-11-2), a former UFC middleweight contender who has remade himself as a welterweight.
But he couldn't resist a tweet aimed at Hendricks.
"I knew you'd find a way out @JohnyHendricks," he wrote.
Marquardt lost his Strikeforce 170-pound title by unanimous decision to Tarec Saffiedine in January at the last Strikeforce show.
He offered up his services against Ellenberger, tweeting: "Just so happens I'm free that night! ;) Whatcha think??"
In other UFC 158 news, Sudbury bantamweight Mitch Gagnon (9-2) is out through injury. T.J. Dillashaw (7-1) will step in to fight Issei Tamura (7-3).