hi there,
I think the best way would be to take a shuttle from the Munich airport to Ostbahnhof (~30 minutes) and then transferring onto a westbound train line that will take you to
Stuttgart (~2.5 hours).
From Stuttgart's main
station you can then transfer onto the S-Bahn S2 or S3 to Stuttgart airport (~30 minutes).
Hop this helps
Vacationbuddy