The 34-year-old's last game will be against Hoffenheim in the Bundesliga on Saturday.
Khedira joined Hertha in February after five-and-a-half years with Serie A giants Juventus, where he won five Scudettos and three Coppa Italia titles.
He made 77 appearances for Germany and was an important part of the squad that won the 2014 World Cup.
Khedira, who won the Bundesliga with Stuttgart in 2006-07, has made just eight appearances for Hertha this season, with only three of those starts.
"Exactly 14 years ago to the day I was allowed to celebrate the championship with Stuttgart," he told a media conference.
"That was a wonderful day. Today is one that is very difficult for me personally because my football career will be over on Saturday at around 5:15 pm.
"It's a pretty tough step and it's hard for me to talk about, but it's the right decision. Fifteen years in professional football have left their mark and I have to honestly judge what I can and cannot do.
"First of all, I would like to gain some distance and relax. I will stay with football, in what form remains to be seen."