"He suffered a severe heart attack while he was on his way to the Court," Aasia Ishaque, spokesperson of Musharraf's All Pakistan Muslim League (APML) party said.
Musharraf was not feeling well last night and doctors had visited his Chak Shahzad farm house, given him medicines and advised bed rest, Ishaque said.
"While he (Musaharraf) was on his way to the Court today, he had chest pains and he was sweating. Tests done at the hospital showed he had suffered a heart attack," she said.
Ishaque said the 70-year-old former president was admitted to the "Critical Care Unit" of the Armed Forces Institute for Cardiology in Rawalpindi (AFIC) and was conscious.
Musharraf's wife was beside him and his 95-year-old mother called from Dubai but was not able to talk to him as doctors have not allowed anyone to talk to him, she said.
"We are sorry to inform that APML Quaid Pervez Musharraf suffered a heart attack on his way to the Court," Ishaque tweeted.
The former military ruler is accused of suspending, subverting and abrogating the constitution, imposing an emergency in the country in November 2007 and detaining judges of the superior courts. If convicted, Musharraf could face life imprisonment or death penalty.
Outside the court, Musharraf's lawyer Ahmed Raza Kasuri said, "He wanted to come to the court but his health deteriorated suddenly and hence was rushed to Armed Forces Institute of Cardiology. My God keep him well."
Asked if Musharraf was afraid of court, Kasuri said, "He is a commando and a commando fights. Musharraf's temperament is that he is not afraid."
Musharraf has twice failed to appear before the court after bombs were found on his route and this was the third time he was unable to attend the hearing in the high treason case.
Earlier, Dr Raza Bokhari, Musharraf's international spokesperson said in a statement, "We can confirm that former president Musharraf is admitted in a military hospital in Rawalpindi, Pakistan. He is conscious, oriented in time and space and is being examined by Pakistani military doctors.
"We pray to Allah for his speedy and full recovery".
DIG Jan Mohammad informed the special court that Musharraf was rushed to AFIC after he complained of heart problem on the way to the court.
Musharraf left his sprawling Chak Shahzad farmhouse today but the long motorcade was diverted to the hospital midway.
High drama was witnessed at the special court where Musharraf's lawyer Anwar Mansoor staged a walk-out, citing lack of sleep over alleged disturbances outside the door of his residence.
"I was under total threat...from 1:00 am to 5 in the morning someone was ringing my bell," Mansoor told the court, adding he had never faced such an incident in his 40-year career.
The court promised to probe the incident but he walked out off, followed by other members of Musharraf's legal team.
Musharraf was supposed to appear before the court to face trial in the high treason case that could put to test the relationship between an assertive civilian government and the powerful army.
Musharraf's legal team head Sharifuddin Pirzada alleged that chief prosecutor in the case Advocate Akram Shaikh had threatened him through Barrister Ibrahim Satti, who is another counsel for the former president.
The treason hearing against Musharraf resumed amid strict security arrangements in place from his farmhouse to the court premises and around it.
The security arrangements made over the expected arrival of the former president included mobile phone jammers, at least 1,000 police personnel, deployment of containers to cordon off traffic and bomb scanners.
The court had ordered Musharraf to appear before it today and also warned him of issuing a ruling, in case if he failed to appear.
His legal team also filed a plea in the special court to exempt him from appearing till Monday.