A real piano string, for instance, is made of metal and resists bending slightly unlike an idealised string. This affects higher harmonics more than lower ones (think of all the bends in the string on the 7th harmonic, for example). This increases the harmonic frequencies slightly above exact integer multiples of the fundamental.
As a result, pianos require "stretched tuning" so the harmonics better match the higher notes. It's always a bit of a compromise. The higher harmonics will be more "off" than the lower ones.
So even if you were to tune the fundamental frequency of all the keys on a piano "perfectly" in a given key (so-called Just Intonation), the harmonics would not perfectly match up.