Yes, the word greenhorn did at first apply to horns that were green, green, that is, in the sense of young and tender, such as those of a young ox.
Then the term was next applied in a more figurative sense to raw, untrained, and inexperienced soldiers, those who might be characterized as not yet dry behind the ears.
And from that, still in the seventeenth century, the final extension was easy, and the greenhorn became what he is today, one who is a novice or an ignoramus in any given trade, line, or profession.