Thermocouples rely on the Thermoelectric effect - an electromotive force (EMF) is produced between conductors placed in the two bodies. By measuring the voltage between them, the change in temperature between the bodies can be found. Then if the absolute temperature of one is known the other can be worked out.
The advantage of thermocouples is that they can detect very minor changes in temperature, over very large temperature ranges. It can also detect any changes to temperature very quickly. However the increase in EMF is not linearly proportional to the voltage produced so the apparatus has to be calibrated carefully.