The Spanish tennis master is suffering from tendinitis of the knee and says he is “not in condition” to take part in the tournament.
Nadal, who exited Wimbledon in the second round last month, is the defending champion of men’s Olympic tennis after winning gold in Beijing.
“I am not able to compete at the Olympics in London and therefore will not be traveling as planned with the Spanish delegation,” he said in a statement on the Spanish federation (RFET) website.
“I have to think about my colleagues. I cannot be selfish and I have to think of the good of Spanish sport, especially Spanish tennis, and let a team-mate who is better prepared to compete.
“I’ve waited until the final moment of my preparation and my training, but I cannot do it.
“I do not find myself in a condition to compete,” he said. “It is one of the saddest moments of my career.”
Nadal was also set to carry the flag for Spain in the opening ceremony.