Magic.
Scarlet Witch has abilities that are, obviously, well beyond what actual people can do. While they have never actually used the word "magic" in the movie universe, in the comics, her power is explicitly magical. As such, it's unfair to expect it to have any basis in physical reality.
In the movie, she was given telekinetic and telepathic powers by the Mind Stone embedded inside Loki's scepter. This allows her to, among other things, exert a force against objects mentally, without having to be in contact with them. In this specific case, she was able to exert a force against the train that was detached from the train -- it wasn't her body that was pulling against the train's wheels, it was entirely mental, so it didn't matter that she was inside the train at the time.
If you look carefully, a lot what she is doing is just applying the brakes: she stops the wheels from turning in the same way that a braking system does. However, we can also see her "pulling" on the train as she does so, to bring it to rest further. The braking part, of course, is just friction, but the other part is all down to her powers.