The Portuguese club said Casillas fell ill during a practice session and remains hospitalized, but the "heart condition has been resolved."
It said the 37-year-old Spaniard is "doing well" and is in stable condition.
Porto said the practice session at the team's training center was interrupted so doctors could attend to Casillas.
No timeline was given for how long the goalkeeper will be sidelined. Defending champion Porto trails Benfica by two points in the Portuguese league with two games left.
Messages of support poured in from clubs and players across the world.
"Real Madrid wishes to offer its full support to our beloved captain Iker Casillas," the Spanish club said in a statement. "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 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 joined Porto in 2015 after 16 seasons with Real Madrid, which he helped win five Spanish league titles and three Champions League trophies.
Casillas also helped Spain's national team win one World Cup and two European Championships.
The goalkeeper's contract with Porto was recently extended until the end of the 2019-20 season, with an option for another one-year extension.