There are several false explanations circulating about this phrase, probably because the metaphor is not an obvious one. One is that it is a corruption of spirit and image, from the belief that people who looked alike shared a soul. Another is that it is a corruption of splitting image, referring to a person being split into two identical persons. Both of these are incorrect. They are after-the-fact explanations that are not supported by evidence. Instead, the spit is just that, saliva.
The metaphor at work is that of a person spitting out an exact replica of themself. Spitting image dates to 1901. Spitten picture is a bit earlier, dating to 1878. The very spit of is even older, dating to 1825. And use of the metaphor of fathers spitting out look-alike sons dates to at least 1400.-- www.wordorigins.org