This was asked very recently (http://www.italki.com/question/337183), so I have copied my answer across:
Both of these idioms have quite a few meanings. But the two meanings that are closest relate to completing something before a deadline, e.g. arriving on/in time for the start of your job, or handing in a school assignment on/in time.
In these contexts, both expressions are fine, and many speakers would use them interchangeably. But there are some subtle differences. 'On time' usually includes within its meaning 'not early and not late'. In time, on the other hand, just means 'any time before the deadline'.
In practice though, they often are interpreted the same.
to come in time for dinner.
in the future; eventually:
In time he'll see what is right.
in the correct rhythm or tempo:
There would always be at least one child who couldn't play in time with the music.
at the specified time; punctually.
to be paid for within a designated period of time, as in installments:
Many people are never out of debt because they buy everything on time.