Marshburn joined NASA in November 1994, serving as a flight surgeon at Johnson Space Center in Houston, Texas. He was assigned to Space Shuttle Medical Operations and to the joint US/Russian Space Program. From February 1996 to May 1997 he served as a flight surgeon for NASA personnel deployed to the Yuri Gagarin Cosmonauts Training Center, Star City, Russia, followed by work in the Center for Flight Control in Korolyov, Russia, in support of the NASA Expedition 4 to the Mir Space Station. From July 1997 to August 1998 he was co-chair of Medical Operations for the Shuttle–Mir Program. From 1998 to 2000, he was deputy Flight Surgeon for Neuronal and lead Flight Surgeon for the STS-101 mission to the International Space Station. After spending ten months as a NASA representative to the Harvard/MIT Smart Medical Systems Team of the National Space Biomedical Research Institute in Boston, Massachusetts, he worked as the lead Flight Surgeon for Expedition 7 to the ISS in 2003, supporting from Russia, Kazakhstan and Houston. Until he was selected as an astronaut candidate, Marshburn served as Medical Operations Lead for the ISS. His activities included development of the biomedical training program for flight surgeons and astronaut crew medical officers, and managing the ISS Health Maintenance System. Marshburn was selected in May 2004 to be a NASA astronaut. He completed his Astronaut Candidate Training in February 2006. This included scientific and technical briefings, intensive instruction in Shuttle and International Space Station systems, physiological training, T-38 flight training and water and wilderness survival training. He was qualified for various technical assignments within the Astronaut Office and future flight assignments as a mission specialist. Marshburn's first flight was on STS-127, which lifted off on July 15, 2009 at 6:03 p.m. EDT and landed on July 31, 2009. The mission delivered the Japanese-built Exposed Facility and the Experiment Logistics Module Exposed Section to the International Space Station. Marshburn took part in three spacewalks during the mission. In May 2010, Marshburn served as an aquanaut during the mission aboard the Aquarius underwater laboratory, living and working underwater for fourteen days. Marshburn served as a Flight Engineer on Expedition 34/35 to the International Space Station, launching aboard Soyuz TMA-07M on December 19, 2012, from the Baikonur Cosmodrome in Kazakhstan, along with crew members Chris Hadfield of the Canadian Space Agency and Russian cosmonaut Roman Romanenko. The crew was welcomed aboard the ISS by Expedition 34 commander Kevin A. Ford and cosmonauts Evgeny Tarelkin and Oleg Novitskiy. On May 11, 2013, Marshburn and Expedition 35 flight engineer Christopher Cassidy performed an unplanned spacewalk to replace a pump controller box suspected to be the source of an ammonia coolant leak. Marshburn and his crew returned to Earth on May 13, 2013. In 2019, he served as back up flight Engineer 1 for the Soyuz MS-13 and Soyuz MS-15 long-duration flights to the ISS, first backing up Italian astronaut Luca Parmitano, and the American-Swedish astronaut Jessica Meir.