If you want to understand the creation myths literally, then there are three obvious possibliities :
Either Cain and Abel had sisters, whose names have not come down to us, and had children with them, or they had a child with their mother, or they were not acutally the only people on earth.
The first two possiblities later generations consider incestuous and wrong, but could be explained by them having no other way to obey the injunction to be fruitful and multiply!
The Creation story we read in the bible is the explanation given by one religious tradition originally. Presumably there were other people on earth at the time, with other traditions and Adam and Eve's sons, or at least Cain and Seth, as Cain had killed Abel probably before Abel married anyone, can have married women from another tribe.