The 33-year-old, who is missing the World Cup through an injury picked up in the FA Cup final victory, was released by Chelsea at the end of last season.
The midfielder is returning to the Bundesliga and his old side, with whom he reached the Champions League final in 2002
"With my transfer to Bayer Leverkusen a circle is complete. I had a beautiful and successful time here, on which I like to look back on a lot," Ballack said on his new club's official website.
"That was a factor in my decision."
Ballack added: "But above all the good sporting potential of this young and attractive team were persuasive.
"I am especially looking forward to the great fans, who naturally have been key in my decision to return to Bayer."
Ballack, who spent three years with Bayer before leaving for Bayern Munich in 2002 and then moving on to Chelsea in 2006, will reportedly earn around 12million euros over a two-year stay at Bayer.
Steve McClaren's Wolfsburg were also believed to have been interested in him, but Ballack has opted for a return to his old club.
Bayer sporting director is delighted to have signed a player of Ballack's experience, and believes he will help the development of the club's crop of young players.
"With Michael Ballack our team is getting an enormous boost in quality," he said. "Especially our many young players will benefit from his abilities and his experience.
"We did everything to convince Michael. That his preference was for Bayer despite our limited financial possibilities in comparison to the competition, shows his emotional attachment to the club."