I am hoping to go from Florence to San Gimignano in the afternoon (16:00) and then leave sometime in the morning for Rome. Can this be done by train, or do I need to bus out of and back into Florence?
Since Poggibonsi is the closest train station, a 30 minute bus ride away, and all connections from there to Rome go through Florence, just taking the bus back to Florence will be the simplest way.
From San Gimignano you need a bus to the Poggibonsi station. A 25 min ride.
http://www.comune.sangimignano.si.it/it/turismo-cultura/turismo/come-arrivare-a-san-gimignano/orari-extraurbano-poggibonsi-san-gimignano
Then from the Poggibonsi station you can take a bus (50 min ride):
http://www3.unisi.it/eventi/csgi/autobusfi.pdf
or you can take a train (64 min ride with most trains):
http://www.trenitalia,com
(Use the timetable for the next 7 days, as regional train schedules are loaded weekly. They won't change)
Check the timetable and see the best option for your time of travel