The sixth seed was losing 6-4 4-0 to Spain's Anabel Medina Garrigues when, having called her trainer on to court during the first set, she finally retired from the match.
Wozniacki withdrew suffering from a respiratory illness, and with the start of the French Open less than a fortnight away there are fears that the former world number one will not recover in time.
The 21-year-old's withdrawal means that, should China's Li Na reach the semi-finals in Rome, she will not be among the top eight seeds at Roland Garros. The reigning French Open champion progressed after beating Czech Republic's Iveta Benesova 6-1 7-5.
Medina Garrigues will face Serena Williams in the third round after the American made it safely through as she collected her second win in the space of 18 hours as she battled back to beat Russia's Nadia Petrova 4-6 6-2 6-3.
"It was very difficult for me today," Williams told a delighted crowd in Italian. "I hope that I can play better from here."
World number one Victoria Azarenka of Belarus cruised past Israel's Shahar Peer 6-1 6-2 before the Belarusian also withdrew from the tournament through injury, while 13th seed Ana Ivanovic had an easy ride against Spain's Silvia Soler Espinosa in a 6-2 6-1 victory.
The Serb next plays second seed Maria Sharapova.
"It's nice to get back-to-back wins here, especially after a tough first round against Svetlana," Ivanovic said.
"The next one will be even tougher. Maria and I had a great first set in Indian Wells before I had to retire, and she has been playing better and better on clay. But I'm playing well right now too.
Venus Williams improved her chances of making the Olympics on merit as she battled to a 7-6 6-1 win over Ekaterina Makerova of Russia.
There was a shock defeat for world number three Agnieszka Radwanska as she was ousted 6-4 4-6 6-1 by Petra Cetkovska of the Czech Republic.