We did this. Went to Florence first and then to Pisa on the return trip. The trip from Pisa to Livorno is only 10 to 15 mins. So save it for last so you can better judge them time.
You might consider a taxi from the train station to the Tower in Pisa to save time. Also, in Florence if you have a known place you want to visit. It will save you some time. We walked in both places so that is possible but we were exhausted when we got back to the ship.
See the "train travel in Italy" post for more information.
Carnival Cruise Lines:
Fantasy 90, Celebration 95, Victory 05, Conquest 05, Spirit 6/06, Freedom 6/08, Holiday 7/08, Victory 6/09, Valor 9/09, Dream 6/10, Splendor 8/10,Conquest 8/11,Magic 11/11,Triumph 4/12,Spirit 7/12,Freedom 11/12, Triumph 2/13 - The fire cruise, Magic 1/14
NCL Dream October 2006, RCCL Mariner OTS June 2007, Celebrity Silhouette 2013