The former Chelsea striker was forced off after just 19 minutes of the 4-0 win on Wednesday evening.
A statement from RB Leipzig read: "Timo Werner suffered an ankle injury last night in the win over Shakhtar Donetsk.
"Scans today in Leipzig showed that he has unfortunately torn the syndesmosis ligament in his left ankle and will therefore be out for the rest of 2022."
Reacting to the news, Germany manager Hansi Flick told the team's official Twitter account: "It's very sad news. I feel really sorry for Timo that he will miss a World Cup that he was determined to play at.
"Above all though, his absence is a big loss for the team. We all wish him a speedy recovery."