The defender had been contracted to the Spanish champions for another two years but the club announced they have agreed to "rescind" the deal.
Marquez, 31, will participate in a "farewell ceremony" on Saturday evening, according to the club, at which president Sandro Rosell will be present.
"Today's announcement brings the curtain down on Rafa's superb career with the club he joined in 2003," said a club statement.
"As a Barca player he's won four league titles, two Champions Leagues, the World Club Cup, the European Super Cup, the Spanish Cup and three Spanish Super Cups.
"The 31-year-old Mexican international defender has played 242 games for the Club, which puts him eighth in the ranking of foreign players. He's been a fixture in the plans of both of the Barca managers he's served under at the Club, Frank Rijkaard and Pep Guardiola."