She didn't know the way home.

Literal

She [topic-は] return-road [subject-が] was-not-known.

帰り道 is a compound noun — the masu-stem 帰り ('returning,' from 帰る) + 道 ('road, way') — for 'the way home.' Many Japanese compounds work this way: 行き道 ('the way there'), 通学路 ('school commute path'), 散歩道 ('strolling path'). The が on 帰り道 marks the subject of 分かる, an emotion/cognition predicate that's notorious for taking が rather than を on its notional object — same pattern as 好き, 嫌い, 上手, 下手. Compare: 日本語が分かる ('I understand Japanese'), not 日本語を分かる.