In answer to your related question "How did people know right from wrong before the law?", I included the following:
There was always a 'law' before it was written on tablets of stone and given to Moses: God sets the standard of righteousness by what remains in accord to His nature and unrighteousness by what constitutes rebellion against His nature. (emphasis added)
That was supported by citing the commandment (i.e. a law) of God to not eat the fruit of the tree of the knowledge of good and evil. Elsewhere (Rom 8:2) Paul refers to the 'law of sin and death' which has been in effect as a priniciple since at least the fall but arguably derives from the first commandment given.
When Paul refers to 'before the law was given' he is of course referring to the Mosaic law, but the phrase 'sin is not counted where there is no law' is somewhat hypothetical (there has always been 'law') and must be viewed in the sense of specifics rather than generalisations - '(specific) sin is not counted where there is no (specific) law' not 'sin (in general) is not counted where there is no law (at all)'.
Althought there has always been 'law' to some degree, there were certain levels of depravity that people were initially innocent about - the depths of wickedness were discovered progressively (although the progression from wilful disobedience to fatricide only took one generation). Some things (e.g. drunkenness) only became problematic after other conditions were fulfilled (discovering the fermentation process and later fortification/distillation).
A specific example is the law of incest:
9 You shall not uncover the nakedness of your sister, your father's daughter or your mother's daughter, whether brought up in the family or in another home. - Leviticus 18:9 ESV
Which Abraham at least (but almost certainly many, if not most, of the early patriarchs) was 'guilty' of according to the later law, but actually innocent because the conditions that necessitated that law had not yet arisen.