The Porto goalkeeper, 37, reportedly felt pain when on the training pitch according to A Bola and TVI report he was rushed to hospital where he had emergency surgery.
He is now in recovery having suffered a myocardial infarction and is not expected to play for the remainder of the season, according to reports in Portugal.
Casillas posted a photo from his hospital bed, thanking fans for their support.
Benfica win another league title after crushing Santa Clara
Casillas' club Porto confirmed the news of the heart attack on in a statement earlier in the day.
"Our goalkeeper suffered a heart attack during the morning training session on Wednesday." The club said.
"Iker Casillas suffered an acute myocardial infarction during Wednesday morning training session held at the PortoGaia Training and Training Center in Olival.
"The work session was promptly interrupted to provide assistance to the FC Porto goalkeeper, who is currently at the Hospital CUF Porto. Casillas is well, stable and his heart problem solved."
Casillas - Decima Real Madrid 2019 - Getty Images
Image credit: Getty Images
He is Real's second all-time appearance maker, playing 725 matches between 1999 and 2015, winning five La Liga titles and three Champions League crowns with the club. His former team mate Raul made 741 appearances for Real.
Madrid wished their former captain a full recovery.
"Real Madrid would like to offer all our support to our beloved captain Iker Casillas. Throughout his professional career, he always overcame the hardest challenges in order to bring glory to our club," Real said in a statement.
"He has taught us to never give up and has shown us numerous times that the best way to win is to remain as strong as possible when times are tough. Real Madrid and all our fans wish him a speedy recovery and send him all our support."
The goalkeeper was captain during Spain’s dominant period in international football that saw them win the 2010 World Cup as well as the 2008 and 2012 European Championships.
Pepe returns to Porto
Mourinho rejects chance to manage Benfica - reports