This is one occasion when it is worth getting the transit (shuttle) bus to Florence from the ship. It's easy, reasonably cheap and you get dropped right in the middle near the Ponte Vecchia. .regards...Ida
Yes it is possible but Florence is 60-70 miles away and takes around 1.5 hours for the train journey alone. See trenitalia for times.
The train station in Livorno is some distance from the city centre and you need to get a bus to get there from the port shuttle drop off point. However, just across the road from the drop off point, there is a tobacconist who sells bus/train tickets and speaks good English. You will se a sign outside for bus/train tickets. We went to Pisa on the train with no problems but quite honestly you will spend a lot of your day travelling to get there and back to Florence.
Go on the ships coach trip that just offers a get you a there and back service. Livorno docks is also a container port and you can't just walk out of it to the main street and taxis alongside the ship are usually in short supply (and want to take people on a tour, not a trip to the station!). All this will take up valuable time that could be spent in Florence. Also, don't forget if you have problems getting back from Florence the ship will sail without you whereas they will wait for a ship organised bus.