Messi has a clause in his contract where he can choose to leave Barcelona on June 30th of each season.
The clause enables Messi to leave for a team outside of Europe, which would eventually pave the way for him to return to Argentina.
Messi has had his contract renewed eight times during his time with the club.
Via Marca