The second seed had lost the opening set and was down a break in the second when he walked to the net and shook his opponent's hand.
The retirement, with the score at 7-6(2) 2-0, came shortly after the 30-year-old Serb called a medical timeout.
'It is time to kick out the Big Three' - Harris says next generation are here to stay
Djokovic said his right elbow had been bothering him for over a year and a half and that he had been feeling pain from the beginning of the tournament.
"The intensity and the level of pain was not decreasing. It was only increasing as the days went by," he said. "Unfortunately, today was the worst day.
"It's unfortunate that I had to finish Wimbledon, a grand slam, this way," he added. "I mean, if someone feels bad about it, it's me. But, you know, I tried."
He also said the postponement of his last-16 match against Adrian Mannarino, which was pushed a day to Tuesday because of the marathon five-setter in which Gilles Muller beat Rafael Nadal, might have played a role.
"Probably the fact that I played yesterday, kind of days adding up, as I've said before, it wasn't helping at all," he said.
The retirement is a another blow for the former world number one, who has surrendered his Australian and French Open titles this year and slipped to fourth in the world.
The result means Berdych, 31, has reached the semi-finals for the second year running. The Czech has also broken a streak of 12 losses against his tormentor-in-chief Djokovic, whom he had previously only beaten twice in 27 matches.
'It's not acceptable' - Djokovic gets 'unfair treatment' compared to Federer and Nadal, says Becker
Laver Cup 2021: How to watch, schedule and updates on players involved