The 14-time Grand Slam title winner will therefore miss November's ATP World Tour Finals in London.
Nadal, 28, made his announcement after losing 6-2 7-6 (7-4) to Croatian teenager Borna Coric in the quarter-finals of the Swiss Indoors on Friday.
"I'm not going to Paris and London - I'm not competitive enough," the nine-time French Open champion said.
"I am going to have surgery on 3 November."
Nadal had already qualified for the ATP World Tour Finals event, so the Spaniard's withdrawal means the player ranked ninth in the final ATP Race to London rankings will make it through to the season-ending event at the O2 in Greenwich.
Britain's Andy Murray will compete in next week's Paris Masters, which is the final ranking event of the season.
The Scot, 27, currently lies in eighth position in the Race to London standings.
The Swiss Indoors in Basel was just the third tournament Nadal had played since Wimbledon following a wrist injury, and he revealed earlier this month that he was on a course of antibiotics for his appendix.
Coric, 17, showed no fear as he raced into a 5-0 lead against a wayward Nadal and held his nerve to secure a stunning victory.
Coric learned his tennis travelling between Zagreb and north London under the guidance of British coach Ryan Jones, although the pair have gone their separate ways in recent days.
The Croat goes on to face Belgian David Goffin in the semi-finals, with Ivo Karlovic up against Roger Federer, who beat Grigor Dimitrov 7-6 (7-4) 6-2.

Jones won 95 caps for Wales and played in five Tests for the Lions across their tours of South Africa in 2009 and Australia in 2013.
Sinckler has played with Jones since the Welshman's move to Quins in 2015.
"When you have guys like that around you, it shows you what it takes to get to the top of the game," Sinckler said.
"He [Jones] has been a massive help to me - probably changed my life, to be honest, in the way I see things.
"He is a top bloke, a good man."
The England forward says he can shine in New Zealand thanks to the lessons he has learned from his fellow front-rower.
"Looking back now, when you are a young player, you want to play. Then you see Adam Jones come in to the club, and you are probably not going to play as much," he added.
"From my first day, Adam has been unreal. He's been like a coach to me, even though he is a player.
"He will be a top coach in no time at all. He's been a coach, a mentor, a father figure to me - and a headmaster when he is telling me off."

Midfielder Mooy scored a 25-yard winner for the Championship leaders.
But Monk was furious Mooy was still on the pitch, believing the Australian should have been given a red card and not a yellow for a lunging tackle on Liam Bridcutt in the first half.
"Two-footed, off the ground, totally out of control," Monk said of the foul.
"I don't want to talk about referees. But if you see that and you can't tell me that's a sending off, I don't know what is.
"It was a horrendous tackle that he made."
Huddersfield head coach David Wagner said Mooy's tackle was not worthy of dismissal in England, but would have been a straight red-card offence in his native Germany.
"In England no red card. Germany, red card," said Wagner, whose side are top of the table by four points after five wins from their six league matches.
"But we are not in Germany, we are in England. This is what I've learned. This was a pretty hard, British challenge.
"It came too late, but I didn't think for one second it would be a red card because I've been 10 months now in British football and I know, this was not okay, he was too late. Yellow."
Rafael Nadal has confirmed he will not play again this season and says he will undergo appendix surgery next month.
[NEXT_CONCEPT]
Lions and England prop Kyle Sinckler says the effect his Harlequins team-mate Adam Jones has had on him is life-changing.
[NEXT_CONCEPT]
Leeds boss Garry Monk said Huddersfield matchwinner Aaron Mooy should have been sent off for a "horrendous" foul in the west Yorkshire derby at Elland Road.