The airport has two terminals: Terminal 1 has a connection to the metro (and buses), while Terminal 2 has both metro and local train (Rodalies) connections. Both the metro and the Rodalies train are at the end of the line, and both go through El Prat de Llobregat station on their way to Barcelona. A map is available on the Rodalies website (the airport is in the bottom left, and Sitges is up and to the left).
If you're arriving into Terminal 2 (mostly low-cost carriers), then the easiest way by train is to take the Rodalies train one stop to El Prat de Llobregat and change there to a train towards Vilanova which will take you to Sitges. You will need to change to the other platform for this as you'll be kind of "doubling back" on yourself (but a ticket will be valid. A single ticket for this route would be a Rodalies zone 1-4 ticket and would cost €4.90. Both trains run every 30 minutes, and the journey in total is timetabled to take around 44 minutes including the 10 minute change at El Prat. All trains from the Airport station stop at El Prat de Llobregat, but from El Prat make sure you get a train going to Vilanova (it will say R2 VILANOVA on the front and side), as some trains on weekdays stop short at Castelldefels (if you do happen to get one of these, you can just change at Castelldefels but you will need to change platform).
From Terminal 1, you'd need to either take the free shuttle bus from Terminal 1 to Terminal 2 and then as above, or alternatively take the metro line L9 to El Prat de Llobregat station and then the Rodalies train as above. There is a supplement on the metro for journeys to and from the airport, and you would need two tickets for this journey (one for the metro and one for the Rodalies train) for a total of €10.40 (€5.50 metro and €4.90 Rodalies). Using the metro, this journey would take around 12 minutes for the metro and 27 for the train, plus waiting and changing times - so roughly around 10 minutes longer than the Rodalies train from T2. The shuttle bus from Terminal 1 to Terminal 2 also takes around 10 minutes, so the times are comparable.
For these trains you can only buy tickets on the day. There are options for multiple journeys - for example if there are two of you and you are planning a day trip from Sitges into Barcelona then you could get a Bonotren which is 10 journeys for €31.45 (valid only on the Rodalies trains) - but in any case you can buy the ticket just before you travel. To complicate matters there are two separate fare scales for multi-journey tickets depending on whether they are valid only on Rodalies trains or also on buses/metro/etc, but for single tickets none of this applies and the pricing structure is "simpler".
For completeness, there is also a bus service from Barcelona Airport to Sitges which runs one bus an hour and takes around 45 minutes.
If you do take the train, for the journey from El Prat to Sitges try to sit on the left hand side of the train (facing direction of travel) as between Castelldefels and Sitges the line runs through a set of tunnels cut into the cliffs and the views are pretty scenic.