The train was extremely crowded, so I had to stand the entire way.

Literal

Train [subject-が] terribly was-crowded so, I [topic-は] the-whole-way the-entire-time had-to-be-standing.

途中ずっと ('the entire way through') combines 途中 ('on the way, midway') with ずっと ('continuously'). 立っていなければならなかった is the full obligation-past form of 立っている — 'had to remain standing.'