You can “slam on the brakes” in a train, but it will often take several minutes to come to a complete stop. If the crew sees a person on the tracks, obviously they will try to stop. However, in most cases, it is simply not physically possible to stop the train fast enough.