'Knee high to a grasshopper' first appeared in an American publication in the 1850s. However, the grasshopper was preceded by a toad, a mosquito, a frog and a bee in such phrases indicating lack of height going back to 1814.
Well, the origin of all the 'knee-high' phrases I referred to above was people's perceived need to find a form of words which expressed how short/tiny someone was.
As for the first recorded occasion of the 'grasshopper' one - ie it appeared in print - that was in The Democratic Review No 28 published in the USA in 1851.