Casillas is recovering in hospital following emergency surgery and is not expected to play again for the club this season.
The 37-year-old goalkeeper suffered the heart attack during training on Wednesday morning and he was immediately escorted to a local hospital.
Porto confirmed that the World Cup 2010 winner is in no further immediate danger and it's hoped he'll make a full recovery.
"Iker Casillas suffered an acute heart attack during Wednesday morning's training session," Porto said in a statement.
"The training session was promptly interrupted to provide assistance to the Porto goalkeeper, who is currently at the Hospital CUF Porto.
"Casillas is doing well, he's stable and his heart problem has been resolved."
The former Real Madrid star originally joined Porto in 2015,
During his illustrious stay in Madrid, Casillas won La Liga five times while also claiming three Champions League trophies and two Copa del Rey crowns, racking up 725 total appearances for the club in the process.
In total, Casillas helped lead the club to 19 trophies during his time at Madrid and also holds the record for most appearances by a goalkeeper in the FIFPro World XI as well as the record for most ever appearances in the Champions League.
Madrid released a statement shortly after the news broke, saying: "Real Madrid CF wants to transmit all their support to their beloved captain Iker Casillas.
"Iker Casillas has taught us throughout his professional career to overcome the most incredible challenges to enhance the glory of our club. He has taught us that surrendering does not fit into our philosophy of life and has shown us countless times that being stronger no matter how hard the challenge is is the path to victory.
Casillas' heroics also extended to his play with the national team, as he was a key piece during one of international football's most successful eras with Spain.
That Spanish team won three major trophies in a row, capturing the 2008 and 2012 Euros and the 2010 World Cup with Casillas starting in each of those finals.
Since joining Porto in 2015, Casillas has won two trophies, including a league crown in 2017-18, featuring 156 total times in nearly four full campaigns.
Casillas, who signed a new two-year contract with the Portuguese club in March, helped Porto reach the Champions League knockout stages once again this season, where they were defeated by Liverpool 6-1 on aggregate.
He's started 42 games this season, including each of the club's league matches as they battle for a second consecutive title.
The club will face Aves at home on Saturday in the first of the team's three remaining league matches before taking on Nacional and Sporting CP in the final two matches of the Primeira Liga campaign.