The train was packed, so she had to travel in second class and stand the whole way.

Literal

Train [topic-は] was-full. Therefore she [topic-は] second-class [instrumental-で] had-to-travel, and the-entire-time had-to-remain-standing.

A longer sentence stringing two clauses with そこで ('therefore, so, in that case'). The double obligation construction ~ねばならない (slightly literary equivalent of ~なければならない) is used twice: 旅行せねばならなかった and 立っていなければならなかった. ずっと ('the whole time, continuously') modifies the second verb. The て-form 立っていなければ shows how ~ている ('be standing,' a resulting-state reading of 立つ) chains into the obligation.