The 33-year-old Chelsea midfielder limped out of Saturday's FA Cup final win over Portsmouth after an unnecessarily heavy tackle from Kevin-Prince Boateng.
An examination in Munich discovered Ballack had torn his ligaments in his ankle. The German national team doctor said he will likely recover and be able to play football again, but not in time for the World Cup.
The DFB said in a statement that Ballack's right ankle will have to be immobilised and put in a plaster cast. He will then have to wear a special shoe for a further two weeks.
With 98 caps and 42 goals to his name, Ballack was a crucial part of Germany's bid to win the tournament for a fourth time.
"I'm angry, of course. The disappointment is naturally huge," Ballack said. "To get such a diagnosis two or three weeks before the World Cup is bitter. But that's football, things have to continue on."
The injury means Germany will face Australia in their opening World Cup game on June 13 without their most important player.
"We were shocked, no question," said German national team coach Joachim Löw. "We now have to marshal our strength. There can be no talk of resignation. We are convinced we can have a good World Cup."
Ballack's departure from the side is another setback for Löw after goalkeeper Rene Adler was also ruled out last month due to injury.
To replace Ballack in the midfield, Löw could turn to Bastian Schweinsteiger, who has had a very good season with Bayern Munich. He could act as playmaker beside Bremen's Mesut Özil.
Löw could also recall Thomas Hitzlsperger (Lazio), or even Torsten Frings (Werder Bremen), two veterans who had fallen out of favour.
The injury is a bitter blow for Ballack who is still looking for a first international success at his final World Cup after 2002 (2nd) and 2006 (3rd). He started his career at Chemnitz before moving to Kaiserslautern (1997-99), Bayer Leverkusen (1999-2002), Bayern Munich (2002-06) and Chelsea.
Making things even harder on German football fans, Boateng will likely take to the pitch with Ghana against Germany on June 23 in the first round of the World Cup.
Though Berlin-born Boateng opted to play for the African homeland of his father, his half-brother Jerome is a German national player. Boateng is also related on his mother's side to the legendary German player Helmut Rahn, who helped Germany win the World Cup in 1954.