The former Spain international felt discomfort in his chest at the end of the morning training session and was taken to CUF Porto hospital.
Porto tweeted a message of support to Casillas followed by a statement confirming the goalkeeper is in a stable condition.
“Iker Casillas suffered a heart attack during a training session on Wednesday morning, at the Porto training centre in Olival,” a statement read.
“The session was brought to a prompt end to attend to the Porto goalkeeper, who is now at the CUF Porto Hospital.
“Casillas is well, stable and with the heart problem having been resolved.”
Former club Real Madrid also released a statement, wishing their former captain a speedy recovery.
“Real Madrid C. F. wishes to offer its full support to our beloved captain Iker Casillas,” the statement read.
“Iker Casillas has shown us how to overcome the most incredible challenges throughout his professional career, adding significantly to our club’s successes.
“He’s shown us that giving up has no place in our way of life and demonstrated time and again that staying strong during the hardest of challenges is the only path to victory.
“Real Madrid C. F. and all of madridismo look forward to seeing our legendary captain back in good health as soon as possible and we send him all the encouragement in the world.
Casillas, 37, started his career with Real Madrid, where he spent 16 seasons and won the Champions League on three occasions as well as La Liga on five occasions before joining Porto in 2016.
He also captained Spain to two European Championships successes as well as the World Cup in 2010.