The train has a big engine in it. Right? This engine makes the wheels turn to pull the rest of the cars. If we consider the train and wheels as the system, the force that changes its momentum is the static friction force between the wheels and the rail.