The characters in Esperanza Rising aren't just running away from Esperanza's super scary uncle. They're also looking for jobs and an opportunity for a better life. In Mexico in the 1920s, people like Miguel, Alfonso, and Hortensia knew that the social divide between the upper class and the peasants was pretty much uncrossable. If you weren't born to an upper-class family, your social and economic status was limited, no matter how hard you worked. (Even Esperanza thinks so, and she doesn't hesitate to snobbishly make that clear to Miguel.)
Cue the American Dream—the idea that, by working hard in the U.S., anyone can be successful. Unfortunately, Miguel and his family learn quickly that the United States of the 1930s has social problems of its own, including rampant racism and discrimination. But despite these setbacks, they soldier on and keep fighting for their dreams.
The train ride from Mexico to the United States represents a space of social transition for Esperanza and her Mama. They are moving from a society that is sharply divided into two classes, to a society in which all Mexicans are seen as equal. The train is the physical connection between these two different spaces, and it's also the first place where Esperanza's Mama teaches her to interact with poor Mexicans as equals.
Miguel and Esperanza were equals throughout the entire book; Esperanza just didn't realize it until the end.