Stuttgart have confirmed the deal on their official website.
Stuttgart coach Christian Gross have been keen to strengthen their attack this summer and sees the 22-year-old as a perfect signing.
Harnik has impressed while on loan at Fortuna Dusseldorf this season.
Harnik has signed a three-year contract with Stuttgart.