She listened to music for hours.

Literal

She [topic-は] how-many-hours-even music [object-を] listened-to.

Same time-counter pattern as the simpler 'waited for hours' line: 何時間も = 'for many hours.' The verb 聞く covers both 'listen' and 'hear,' with context picking the sense; here the object 音楽 ('music') makes 'listened to' the natural reading. A common scene: long stretches of music as background to study, work, melancholy, or exhaustion. 音楽 is one of those Sino-Japanese compounds whose components literally make sense (音 'sound' + 楽 'pleasure, comfort').