There are 5 or 6 trains from Paris to Lourdes per day, and the journey takes about 6 hours - you can get schedules and buy tickets on the SNCF website (although they only list tickets a month or so in advance). On the same website you can also get info about buses and trains to Saint JeanPP from Lourdes - although note they all take a detour via Bayonne!
Otherwise, as Annie suggests you could just walk it - the beautiful hiking trail 'Voie du Piemont' runs through the Pyrenees and crosses Lourdes and SJPP. You could stop off in Oloron Ste Marie and do the beautiful Via Aragones (I did this a few years ago, it was incredible), or even veer off before then at Arudy (as this person is doing at the moment:
https://www.caminodesantiago.me/community/threads/day-one-lourdes-to-asson.33318/#post-299666)
(As an aside: I had a very mixed experience at Lourdes: on one level it's almost like a theme park, with a Disneyesque cathedral, rows of tour buses offloading big groups wearing matching t-shirts, waving national flags, and taking selfies, souvenir shops everywhere, queues of people in wheelchairs or on stretchers, and groups frenetically filling up plastic bottles or even tubs with 'holy water' that comes out of a row of very ordinary-looking taps... However in the grotto itself there's an amazing atmosphere of silence and reverence... anyway wasn't quite sure what to make of the whole thing, best you come to your own conclusions!)