The attack has caused a huge uproar in the Southeast Asian nation, where social media users have called for rapists to be executed.
Police Col Napanwut Liemsa-nguan says rescuers found the girl's body today near the train tracks in Prachuap Khirikhan province, three days after she went missing.
He said police arrested a railway worker who confessed he assaulted and raped the girl before throwing her out of the moving train.
The girl had been travelling from southern Thailand to Bangkok with her two sisters in a sleeping coach. The train is also popular among backpackers traveling back from Thailand's island and beach resort destinations.