Look at the site of Trenitalia for the timetables and book your ticket to arrive at the train station of "Piombino Marittima" where the ferries to Elba Island start www.trenitalia.com