。
She had to stand in the train.
Literal
She [topic-は] train [possessive-の] inside [at-で] standing had-to.
立っていなければならなかった layers three constructions: 立っている (standing — resulting state), なければならない (must), and past tense — 'had to be in a standing state.' The で marks the location of the action.