The 20-year-old Leitner, who joined in 2011 from 1860 Munich, struggled to get a regular spot last season in a crowded Dortmund midfield.
"He fits our demands," Stuttgart sports director Fredi Bobic told reporters. "He is young, highly skilled and understands the game very well. He is also capable of playing several positions."
Leitner won the domestic league and Cup double in 2012 and made four appearances in the Champions League last season but was an unused substitute in their 2-1 final defeat by Bayern Munich last month.
Stuttgart have won a spot in the Europa League next season after losing in the German Cup final to treble-winning Bayern.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.