The train was so crowded that I had to stand the whole way.

Literal

Train [topic-は] terribly was-crowded so I [topic-は] the-whole-time kept-standing had-to-remain.

The causal ~ので ('because, so') links the crowded condition to the standing. 立ったまま ('in a standing state') uses まま ('remaining as is, unchanged'), a powerful nominal that preserves a state across the main action. 立ったままでいなければならなかった = 'had to stay in the standing state (without being allowed to sit).' ずっと emphasizes duration.