The 34-year-old will play his last game as a professional for Hertha Berlin in Saturday’s Bundesliga game against Hoffenheim.
Khedira joined Hertha Berlin on a free transfer from Juventus in the second half of the 2020/2021 season and has made eight Bundesliga appearances so far.
He started his career with Stuttgart, where he won the Bundesliga title in the 2006/2007 season before joining Real Madrid.
With the Spanish giants, Khedira won the Champions League, La Liga and two Copa del Reys before winning five Serie A titles with Juventus.
Khedira won 77 caps for the German national team and played a key role in their 2014 FIFA World Cup triumph in Brazil.
"After the match on Saturday it's time to say goodbye," Khedira said on Twitter.
"So proud that I had the chance to experience all these special moments with you. Thanks to all the fans, team mates, coaches and of course my family and friends."
“Exactly 14 years ago to the day I was allowed to celebrate the championship with VfB Stuttgart. 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 it will be remains to be seen.”