First of all, there is no way this can be done in a day, if you're wanting to actually spend time in Marciana Marina!
First, there is no bus that takes you from Pisa to Piombino. You need to take the train from Pisa to Venturina Terme, from there take the bus from the train station to Piombino Porto (bus 02A). The thing is this already takes about 2 hours.
So that's already 4 hours of your day, not including any time before and in between that and the ferry.
The ferry crossing from Piombino then takes about an hour. So that's another 2 hours, counting both ways. The ferry goes to Portoferraio, and then from there you would need to catch another bus (bus 116) that takes about 35 minutes. Here's the timetable:
https://www.at-bus.it/it/linee-e-orari/livorno-extraurbano-116 So over another hour to make this leg of the trip.
If you can make all the times match up, you would have already used up over 7 hours. Google actually gives me anywhere from around 4 hours to 4.5 hours just one way, depending on the time you leave in the day so I'm thinking it's taking into account times in between getting to a place and the next leg to be done. So it's a lot of hours to be done in a day, of just travel time.
I didn't even look at the timetables for coming back, the opposite way so even buses stop running at a certain time.... I am thinking doing this in a day is not possible, even in July at high season when there are more trains, ferries and buses. At the very least, I would suggest a night sleep over in Marciana Marina.
A better option - if you really want to do this in a day - would be to rent a car for the day, drive yourself down to Piombino, catch the ferry and then drive to Marciana Marina. You still need to time your arrival to catch the ferry on their schedule but one way should be around 3 hours to 3.5 hours. Do searches on Google Maps putting in your date in July, since it can check the timetables for the ferries and give you the best options!!
Best of luck! If it can't be done this trip, maybe you'll need to come back
Do you still have family in the area? It would be great to plan a longer stay just in Elba actually, I love the island, both the beaches and the hiking possibilities!