She was wandering through the forest.

Literal

She [topic-は] forest [through-を] was-wandering.

さまよう (彷徨う) means 'to wander, to roam' with a connotation of being lost or aimless. The を marks the space being traversed — a use of を for movement through an area, distinct from the direct-object を. This traversal を appears with verbs like 歩く, 走る, 渡る, and さまよう. The ~ていた past progressive sets a narrative scene: she was in the middle of wandering.