Emergency services scrambled to Kirkcaldy Railway Station on Tuesday night after two women were spotted walking along the railway track.
Shocked eyewitnesses alerted the authorities after the pair stepped onto the tracks during rush hour and began to walk in an Edinburgh-bound direction.
One man said: “I’m at the station regularly at this time and fast trains cross one another.”
Both British Transport Police and Police Scotland were in attendance and trains were halted.
A spokesman from BritishTransport Police said: “Just before 6pm officers attended Kirkcaldy Railway Station and intervened to remove two women aged 20 and 27 from the railway line.
“They were taken to Victoria Hospital for assessment and appropriate treatment.”