Celestritrain
The Celestritrain (formerly known as the Bikini Bottom Rail Transportation Agency, BBRTA) is a commuter rail system that operates around the Milky Way galaxy that was founded by Eugene H. Krabs himself. The reason for why it can transport people outside Earth is because SpongeBob defied the laws of physics for the plot and built it all the way to Mars and directly caused the combined human/fish effort to colonize Mars. It was originally just a train track that would operate around Bikini Bottom, but SpongeBob built the tracks to go all the way to Mars for some random, unexplained reason. He probably was on cocaine or something.
Simpler terms
This reality-bending, scientifically-impossible-to-construct supersonic train station stretches through the nothingness of space and connects planets to planets. Served as a way for humans to settle on Mars but now serves as a way for aliens to hop to one planet to the other way faster than a UFO could.