Dunbar joined NASA at the Johnson Space Center in 1978 as a guidance and navigation officer/flight controller overseeing Skylab’s reentry mission in 1979. She became an astronaut in 1981 and flew aboard five space flights, netting over 1,208 hours (50 days) in space. Dunbar flew on the Challenger, Atlantis, Endeavour, and Columbia space shuttles. She operated Spacelab, deployed satellites, and performed human medical studies on exercise and muscle performance. She served as payload commander on her last shuttle mission aboard the Endeavor for a mission that lasted nearly nine days.