The woman had a 20-year-old man in her car as she drove towards Brockenhurst station in Hampshire's New Forest.
She turned on to the main line between Bournemouth and London Waterloo and drove for 80 yards on the tracks before her car came to a halt.
A British Transport Police spokesman said: "BTP and Hampshire Police officers attended the line near to Brockenhurst rail station after a report that a car had been driven on to the line from the level crossing.
"Officers were in attendance at the scene whilst the vehicle was removed by recovery vehicles."
Rail services in the area were disrupted as a result of the incident, with buses brought in to replace trains.