‘On time’ means ‘at the planned time’; that is, neither too early nor too late. The opposite is ‘early’ or ‘late.’ It is often used to refer to timetabled events.
I just checked with the airport; the flight is on time.
I want the meeting to start exactly on time.
‘In time’ means ‘with enough time to spare’ or before the last moment. Its opposite would be ‘too late.’
He would’ve been dead if you hadn’t got him to the hospital in time.