Planets and elements are associated via their qualities: warm/cold and dry/wet. As early as Ptolemy, writing almost 2000 years ago, the planets were being ascribed with those same qualities. Thus, for example, Venus and the moon are both described as cold and wet, so eventually those bodies were associated with the element of water, which is also cold and wet.
As a note, both the sun and the moon were commonly described as planets for many centuries, thought to orbit the earth just as the other planets were thought to.
Uranus, Neptune and Pluto were unknown, as they are only visible by telescope, which wasn't invented until the 1600s. Thus, they are not a part of historical understandings of astrology or astronomy, although some modern schools of astrology include them.

