Dembele was injured during Saturday's Spanish league match at Getafe, when he needed to be substituted in the 28th minute.
The France worldwide Dembele - signed from £96.8m from Borussia Dortmund last month - was forced off on in his first league start for Barca in the 2-1 Liga win at Getafe after only 29 minutes on Saturday with tests revealing the extent of the problem.
The French global has made just three appearances for Barca since sealing his move from Borussia Dortmund last month for a fee that could rise to as much as 145 million euros based on performance-related bonuses.
Dembele was clutched his hamstring and hobbled off to be replaced by Gerard Deulofeu.
Dembele, 20, became Barcelona's most expensive signing on August 25 when he moved to the Camp Nou from Borussia Dortmund.
Davis Cup Tennis 2017: France, Australia Earn Wins in Saturday's Play
Jo-Wilfried raised his level in set number 2, sailing through his serve games and mastering the points with his strong forehands. With Tsonga's win, the French reached an unassailable 3-1 lead and the teams decided against playing the final rubber.
Barcelona's official website said that a full recovery he will need 3-4 months.
OUSMANE DEMBELE has been pictured in a wheelchair before he flies to a hospital in Finland for an operation for a torn thigh muscle.
Given he is unlikely to play again until 2018, Barca will have to find a way of keeping pace in La Liga and navigating the UEFA Champions League group stage without him.
Barcelona signed Dembele from Borussia Dortmund in a deal that could reach almost 150 million euros ($180 million), the biggest ever in the history of the Catalan club. The only negative point comeback victory was the injury to Dembele.
The France forward was making only his third appearance with Barcelona.