A while back, I was in DC and considered a day trip (by train) to Baltimore to see Fort McHenry. That ended up not working out, but. . .
From a cursory glance, it doesn’t appear that any Baltimore trains get particularly close to Fort McHenry, although the bus service, taxi, or hoofin’ it would have been available.
On a weekday, there are MARC commuter trains that run to Camden station. From there, you can walk a short distance to the Inner Harbor and catch a water taxi to Fort McHenry.
On the weekend, trains only run to Penn Station further downtown. From there, you can take the light rail to the Inner Harbor and then catch a water taxi, but that’s three forms of transportation at that point. You might just take a taxi from Penn Station to Fort McHenry.