She [topic-は] thought [in-に] absorbed [while-ながら] here-and-there was-walking.
物思いにふける ('to be lost in thought,' literally 'to be immersed in thinking about things') is a literary set expression. ~ながら links the mental state with the physical wandering.