This started out as a comment responding to other comments made on femtoRgon's Answer but then it got long (+ it's essentially an Answer too, so I figured I might as well add it as such).
The King James Version is actually an update of previous English Bibles like the 1560s Bishop's Bible, which says that
Cain also knewe his wyfe
and the 1580s Geneva Bible, which has:
Kain also knewe his wife
All three translations rely quite heavily on the ancient Latin Vulgate Bible, actually, translating quite closely cognovit autem Cain uxorem suam, which could just as correctly be rendered "Cain was cognizant of his wife". The English term recognise comes from the same Latin root, referring to the action of perceiving or seeing someone with whom one is already familiar. So another way of putting it could very well be: "Cain recognised/acknowledged his wife".
Of all this the Ancient Greek—or Septuagint [or LXX], as it is called—translation says pretty much the same thing:
Καὶ ἔγνω Καιν τὴν γυναῖκα αὐτοῦ
"And Kain egno his woman".
English know actually derives from that Greek word, which in this passage simply means sexual intercourse, the most intimate way in which a person can be known in most human contexts. (FemtoRgon's response addresses this quite well.)
Where the wife came from is simply never stated anywhere in the text. It can only be inferred from the scanty evidence provided in the narrative. For all we know (no pun intended), she could be a member of the same mysterious family referred to as "the sons of God" in Genesis 6, one of the most tantalisingly ambiguous passages in the Bible. [That tiny tidbit of Ch. 6 info inspired the Book of 1 Enoch, an 108-chapter anthology of what those who don't consider it canon might be inclined to see as a massive tome of ancient sci-fi fan-fiction. In Enoch these "children of God" are called the egregoroi {or in Aramaic, iyrin}, "watchers"].
In the [Greek] LXX, the same essential sentence construction employed in Genesis 4.17 is what begins the same chapter in v. 1, to describe the conception of Cain himself:
Αδαμ δὲ ἔγνω Ευαν τὴν γυναῖκα αὐτοῦ
"And Adam knew [egno] his woman Eua".
From that "knowledge," Cain is born. A continuation of the theme of knowledge is most likely intended here: the first time the concept occurs in the story ever since the consumption of the fruit of the Tree of the Knowledge in the park [or "garden" as it is almost invariably translated in English].
At any rate, by this point in the story I think it's safe to assume that Adam and Eve have definitely already met each other before, and Adam's knowing of his wife cannot mean that they are meeting for the first time.
The arrival, in Ch. 6, of "the sons of God" (whoever those are) among "the daughters of Adam" (whatever that implies but also may not mean), is, however, not in the scope of most interpretations of the identity of Cain's wife (I am the first person I know to suggest that she might have been a Watcher). In 1 Enoch the iyrin/egregoroi first take human wives only generations after Cain's own family begins to grow. This would appear to follow the common interpretation that Cain was married to his sister.
The apocryphal Book of Jubilees names all the wives of the sons of Adam who are mentioned in Genesis, identifying Cain's wife as his own sister Awan and Seth's wife as his own sister Azura. In another tradition Cain's wife is called Aqlima, and she is in fact his twin.
The understanding in the sister-wife interpretation is basic and standard: Cain kills his brother Abel for some reason or other. Cain then either takes one of his sisters (in the version featuring Aqlima, Abel also has a twin sister) and marries her after his flight from home, or he is in fact already married to her at this point. There does not appear to be any ancient interpretation in which Cain somehow meets a relative after his flight and only then marries her. Which is not to say that it is impossible for it to be read that way. It absolutely leaves itself an open question. And a mystery. (Unless, i.e., stuff like the Book of Jubilees should be taken to heart.)