Forbidden sexual relationships can be found in Leviticus 18:6-23 which includes no sex with a sister. So why wasn't it a sin for Cain & Seth to take their sister as their wife and for Abraham to take his half sister Sarah, daughter of his father but not his mother (Gen. 20:12), as his wife? Because it wasn't a sin before the law was given to Moses to give to the people according to Romans 4:15 which says, "Because the law worketh wrath: for where no law is, there is no transgression." There was no law against having their sister as their wife before the law was given to Moses on Mt. Sinai.
This also means it would have been a sin for Amram, the father of Aaron, Moses & Miriam, to have his father Kohath's sister Jochebed as his wife if the law had been in existence at the time of their marriage because Leviticus 18:12 says, "Thou shalt not uncover the nakedness of thy father's sister: she is thy father's near kinswoman." However, Amram & Jochebed are innocent of that sin because there was no law forbidding it. The same holds true for Abraham marrying his half sister Sarah because Lev. 18:9 states that they are not to uncover the nakedness of thy sister, the daughter of thy father...which is how they were related before marriage.
It would also have been a sin for Lot & his two daughters to have sex if the law was in existence at the time because Lev. 18:6-7 says, "None of you shall approach to any that is near of kin to him, to uncover their nakedness: I am the LORD. The nakedness of thy father, or the nakedness of thy mother, shalt thou not uncover: she is thy mother; thou shalt not uncover her nakedness." But it wasn't a sin until Moses was given the law to give to the people.
As for Tamar, the daughter-in-law of Judah, who had twin sons Pharez and Zerah by Judah from whom the Lord Jesus was descended, the law hadn't been given to Moses yet to give to the people in regards to uncovering the nakedness of thy daughter-in-law.
Lev. 18:15, "Thou shalt not uncover the nakedness of thy daughter in law: she is thy son's wife; thou shalt not uncover her nakedness."