Former Spain keeper Casillas is in a stable condition after a heart attack during training with Porto.
The 37 year-old – Spain's record appearance maker with 167 caps – was hospitalised but the Portuguese giants confirmed his "heart problem resolved".
After leading Barcelona to a 3-0 win over Liverpool in the Champions League semi-final first leg, two-goal hero Messi sent his well wishes to the former Real Madrid star.
"Happy with the result of tonight," Messi wrote via Instagram post-match. "But we still have to go to Anfield, a very difficult stadium, where Liverpool – who are a great team – will push hard.
"The most important moment of the season is coming and we have to be closer and united than ever.
"Finally I want to take this opportunity to send a hug to Casillas and wish him to recover very soon."
Contentos con el resultado de esta noche. Pero aún nos queda ir a Anfield, una cancha muy difícil, donde el Liverpool que es un equipazo apretará mucho. Viene el momento más importante de la temporada y hay que estar más juntos y unidos que nunca. Por último, quiero aprovechar para mandarle un abrazo a @ikercasillas y desearle que se recupere muy pronto.
Casillas won five LaLiga titles and three Champions Leagues during 16 decorated seasons with Real Madrid, while he was Spain's last line of defence during its golden period – winning Euro 2008 and Euro 2012 either side of the 2010 World Cup.
He joined Porto in 2015 and helped them win the Primeira Liga in the 2017-18 campaign.
This season, Casillas has made 31 league appearances and 42 in all competitions for Porto – which lost to Liverpool in the Champions League quarter-finals.