General manager Daryl Morey made the announcement Tuesday, hours before the Rockets put their 12-game winning streak on the line against the Washington Wizards.
Yao was having a terrific season, averaging 22 points and 10.8 rebounds per game.
"It is not an injury we feel he can play with," Rockets team doctor Tom Clanton said. "I've made the recommendation that it be treated surgically and we are working with him to get other opinions just to be certain that that is indeed what should be done."
If Yao chooses surgery, Clanton said, it would involve placing screws across the bone to hold it together. The second option would be to treat it with a cast and crutches. Both options involve a healing time of about four months.
Clanton would not say when Yao could play again, but said he doesn't expect the center to miss the Beijing Olympics in August.
That possibility is weighing heavily on him though.
"If I cannot play in the Olympics for my country this time, it will be the biggest loss in my career to right now," he said.
He doesn't even want to think about how his absence in the game would affect his fans in China.
"I don't want to try, actually and I don't want to know either," he said.
"This is unbelievable," Rockets owner Les Alexander told KRIV-TV in Houston. "This is the most heart-breaking. This is the worst I've felt."
Coach Rick Adelman and Morey told the team before Tuesday's shootaround. Yao said it was a difficult day for him from the moment he walked into the building.
"When coach tells everybody I am out for the season, everybody is like quiet," he said. "That kind of quietness makes me feel kind of scared, it was quiet like nobody was there and you just feel alone."
Morey said he doesn't believe the injury compromises Houston's playoff hopes. The Rockets were 36-20 entering Tuesday's game.
"We've been playing exceptional ball and Yao's been a huge part of that," Morey said. "We feel very confident about our playoff push. We've managed to step up and play well without Yao in the past and coaches and players feel confident that we're going to continue to play well and make the playoffs this year."
Morey acknowledged that it was difficult news to receive when the team has been playing so well.
"It's a pretty big swing from a high to a low, with how we were playing," Morey said. "We feel like our supporting cast is superior to when we played without Yao in the past. We remain ready for the challenge ahead."
Clanton said there was no specific event that led to the injury, but rather an "accumulation of stresses on the bone. Yao first experienced soreness and pain in his ankle before the All-Star
Game and tests were done Monday when the situation didn't improve.
This is Yao's fourth major injury in the last two years. He missed 32 games last season with a fracture in his right leg and 21 games in late 2006 with a toe infection that required surgery. He missed four games in April 2006 after breaking his foot.
Houston went 20-12 when Yao was injured last season.
The Rockets, who remain in seventh place in the tough Western Conference despite their winning streak, will now have to rely heavily on 41-year-old Dikembe Mutombo. The 17-year veteran has been averaging just eight minutes per game.
"I really feel bad for Yao," Adelman said. "It's just such a shocker. Yesterday morning he was OK and then four hours later, he wasn't. It's tough on everybody, but we've got to move on."
Yao said he took Tracy McGrady aside after speaking to the team and told him the success of the team is up to him now.
"We're in a good situation right now," he said he told McGrady. "Right now is your time."
While it took more than two weeks to discover Yao's injury, Clanton said it sometimes takes months to diagnose.
"This is something that can be treated," he said. "We are catching this at a very early stage."
The Associated Press contributed to this report.