"On time" means one of two things:
1. Something happened at exactly the time it was supposed to happen. "The train was on time" means that the train arrived at its destination at the time given in the timetable.
2. Something happened before a deadline. "I handed in my essay on time" means that I handed in my essay before the latest time allowed.
"In time" means something similar to the second meaning above, but can also mean that there was a bit of a rush at the end. "First, our car broke down; we got it fixed, but then we got stuck in a traffic-jam. Luckily, we made it to the airport just in time to check in."