The 21-year-old Manchester City player will also be sidelined for the friendly away to Denmark on June 6 and the World Cup qualifier at home to San Marino four days later.
"I would really like to have been in Russia," he told the DFB's website. "I have decided, after a conversation with my doctor, to use the summer break for this operation, so I can start the new season without any discomfort."
Sane has won six caps for Germany, although he has made only one six-minute appearance as a substitute in the current World Cup qualifying campaign.
The world champions face Cameroon, Australia and Chile in their Confederations Cup group.
(Writing by Brian Homewood; Editing by John O'Brien)