"Who did he marry if there weren't other people on earth?"
Where does it say this, exactly? Nowhere.
Cain, Abel, and Seth were not the only children of Adam and Eve. It says "...and [Adam] had many other sons and daughters." This, given how the words "son" and "daughter" have multiple meanings in Hebrew, could more accurately be rendered: "...and [Adam] had many other male and female descendants." In addition to Cain, Abel, and Seth, Adam and Even had many other children and descendants. They aren't mentioned by name as Cain, Abel, and Seth are and we aren't told when they were born, but that doesn't mean they didn't exist.
Adam lived to be 930 years old. Several hundred years of sexual intercourse with no birth control can only mean one thing: BABIES! There's no conceivable way that someone can live that long, have that much sex, and only be the father of three people!
If Adam and Eve are truly the first two people on the planet and the ancestors of all the rest of mankind, then it follows that Cain must have married one of his sisters, or one of his nieces (the daughters or descendants of one of his brothers and one of his sisters). There really aren't any other options...
Keep in mind that incestuous marriage like this wasn't yet (at this point in time) forbidden by God.
Anyway, hope this helps you!