From Sorrento you can easily take a train to Pompei. There is a special Circumvesuviana train from Sorrento to Naples, with stops in Pompei and Herculaneum. There run two trains per hour. The ride from Sorrento to Pompei takes 30 minutes and costs € 2.10 per person (valid until 100 minutes after validation).
The 'Pompei S. Misteri Villa' train station is located opposite the entrance of the archaeological site. You can check the train timetable in advance.
TIP: If you plan to continue to the Vesuvius volcano, you can take a EAV-bus at the exit of the train station in Pompei.
How do I get to the train station from the cruise port in Sorrento?
Sorrento train station is about 2 km from the port of Marina Piccola. It's possible to walk there, but the road is very steep. Count on about 30 to 40 minutes. The fastest option is a taxi. Expect to pay € 10 per taxi (4 persons, one way).
TIP: There's a bus every 15 minutes from the port to the train station (orange bus). You pay € 1.50 per person (one way).