Police said the victim was found near to the tracks in Bawtry Road, Doncaster, at 6.30am today and told officers she had been sexually assaulted.
The woman has been taken to hospital for treatment, where she remains.
A British Transport Police spokesman said: “Around 6.30am on Sunday a woman, aged in her 20s, was found in the vicinity of the railway line in Bawtry Road, Doncaster and informed officers she had been subjected to a serious sexual assault.
“She has been taken to hospital for assessment and appropriate treatment. Her injuries are not thought to be serious.
“Enquiries are at an early stage and anyone who has information which can assist the officers investigating the incident should contact British Transport Police .”
If you have any information call 0800 40 50 40 or by texting 61016.