The Swedish defender will sign for Juve in July after Villa refused to sell him during the January transfer window.
"I am very happy with this agreement. Italy will be an important experience, at a prestigious club and in one of the most important championships in the world," he told Juventus' official site.
"Now I must finish the season in an Aston Villa shirt but I really cannot wait to come to Juventus."
The Serie A giants have also confirmed that Lazio defender Guglielmo Stendardo has joined the club on loan until the end of the season.
Juve are facing problems with their backline after losing Jorge Andrade and Giorgio Chiellini to injury, as well as selling Jean-Alain Boumsong to Lyon.
Meanwhile, Mali midfielder Mohamed Sissoko passed a medical and is set to sign for the Old Lady from Liverpool on Monday, before returning to Ghana for the Nations Cup.