Assuming that you have the right to enter the Schengen area without any additional hassle, 10 hours is more than enough to go to the center, hang out there, even do some sightseeing in case you've never been to Munich before, then return and safely catch your onward flight.
There's a direct train/s-bahn connection to the airport that takes around 40-45 minutes from the center. Getting out of the airport is pretty fast, I assume it would take you around 15-20 minutes on a normal day. Obviously you should reserve more time for security checks and that sort of stuff for entering the airport later on, but 2 hours before your flight departure time is very much on the safe side, you usually need much less than that. If you're 100% cautious, it will still leave you more than 5 hours in central Munich. It's a pretty city, I would recommend visiting in case it's your first time and you have the necessary documents to enter the Schengen area.