A client researching how to travel the most interesting way from Barcelona to Lourdes stumbled across this article which I thought was great. It describes travelling across the Pyrenees on the train, with a change at Latour de Carol, (vaguely near Andorra), so at the western end of the French Catalan area. The famous “Yellow Train” also meets at the same point travelling down in the Perpignan direction. The total journey seems to be about 6 hours travelling time between Barcelona and Toulouse + extra for waiting about at the border. Count 2 hours extra from Toulouse on to Lourdes.
This Trip Advisor post has very good information (from 2012).
I would strongly suggest taking the first train from Barcelona if you are hoping to come all the way through to Lourdes on the same day (and visa versa). You never quite know what might happen on the way so its good to have a couple of hours spare up your sleeve.
For the timetable check the Catalonia Region Train Service site. And put in Barcelona-Sants to La Tor de Querol-Enveig.
For the French site check SNCF. Put in Latour de Carol to Toulouse Matabiau or Lourdes.
We’ll see you at the other end!