The 33-year-old playmaker had withdrawn from the Spain squad to play Uruguay in a friendly in Doha on Wednesday, depriving him of a chance to earn his 120th cap, the Spanish football federation (RFEF) said earlier on Monday.
Xavi played most of Barca's 1-1 La Liga draw at Valencia on Sunday before being replaced by Thiago Alcantara in added time.
"After tests this morning revealed a tear in his left hamstring Xavi will be out for the next 15 days and will miss Barca's next two (La Liga) games against Getafe and Granada," Barcelona said in a statement on their website.
"If his recovery goes as planned, he'll be back for the Champions League game against Milan," the statement added.
Spain, the world and European champions, had already lost Real Madrid midfielder Xabi Alonso because of a groin injury sustained in Saturday's 1-0 defeat at Granada.
Alonso was replaced in the squad by Atletico Madrid's Mario Suarez, a 25-year-old former youth international who has been called up to the senior squad for the first time.
Coach Vicente del Bosque did not bring in anyone to replace Xavi and his position will likely be filled by Andres Iniesta or Cesc Fabregas, his Barca team mates.
Barca said in a separate statement that midfielder Alex Song had felt "a twinge in his left knee" and would not be joining up with Cameroon for their friendly against Tanzania.