Used to refer to a specific class period in a school timetable, often with a number (e.g., 1時間目, 2時間目).
1時間目は数学です。
First period is math.
次の時間目は何ですか。
What's the next period?
The third period is math.
5時間目に体育があります。
We have P.E. during the fifth period.
Once second period ends, it's break time.
時間 means 'time' or 'an hour' in general, whereas 時間目 is only used to number a specific class period, as in 3時間目 (the 3rd period).
Compound of 時間 (time, hour) and 目 (ordinal suffix), literally 'the -th hour/period'.