She had a lovely time with them.

Literal

She [topic-は] them [with-と] enjoyable while [object-を] spent.

ひととき (一時/ひと時) is a slightly poetic, refined word for 'a (short) while, a moment' — softer than 時間 ('time') or しばらく ('for a while'). Often used in written Japanese to evoke a memorable, savored period of time. 過ごす ('to spend, pass [time]') takes the duration with を. Note the と on 彼ら is the comitative 'with,' distinct from the quotative と (marking speech or thought) and the comparative と (used in equality/difference comparisons).