The Germany midfielder will move to Serie A champions Juventus at the end of the month when his Madrid contract expires after falling out of favour at the Spanish club last season.
Juve have agreed a four-year-deal with former Stuttgart man Khedira, who was also the subject of interest from Schalke.
But Khedira decided against a return to the Bundesliga and told a media conference ahead of Germany's Euro 2016 qualifier with Gibraltar: "I am very happy this is now fixed and I can now prepare myself for my new club.
"The last few months were perhaps the most difficult of my career because I could not show that I can still do it in Madrid."
Asked about the interest from Schalke, Khedira added: "I had good talks with Schalke but with the changes, especially the dismissal of Roberto Di Matteo, it was no longer as I had imagined.
"I think Juve suits me."
Khedira made just 11 appearances in La Liga during Carlo Ancelotti's final campaign in charge of Madrid.