No-one was hurt, which police described as "incredibly fortunate".
A witness said the car was travelling towards Dunedin and appeared to be out of control for nearly 2km, crashing into road signs and a wheelie bin.
It narrowly missed trees, a van and a drinks table, and "30 or more" runners had to scatter for safety.
"It was nearly multiple mass fatalities", he said.
"There was a huge volume of people. She missed several clumps of runners.
"We were yelling to the runners to get out of the way, because she was coming up behind them.
"It was a very, very close call."
He said a nurse who was competing in the marathon was first on the scene to help the driver once the car had come to a stop.
Senior Sergeant Blair Dalton, of Dunedin, said the incident happened about 9am, when the driver was believed to have had a medical event.
While it had the potential to be a serious incident, none of the competitors were hurt, Snr Sgt Dalton said.
He praised members of the public who came to the aid of the driver.
"Understandably, police have had calls from people who were close to being run over, wanting to know what happened, and asking whether the driver was OK", Sgt Dalton said.
"The driver was assessed by St John and taken to Dunedin Hospital in a moderate condition for treatment. Initial indications suggest this was a medical event and it’s incredibly fortunate nobody was hurt as a result."