You can measure an effect, and draw tentative conclusions, without a total understanding of its cause. You don't need to know what a charge is, to detect that there is some property, and when it is doubled, other things happen, or when the object changes distance more other things happen. A lot of science happens that way.
As for how they actually found that charge was quantified - it appeared in discrete "amounts" - that was Millikan's oil drop experiment. I've already commented on that, at chemistry stack exchange, but it's relevant here as well (see https://chemistry.stackexchange.com/questions/87803/how-do-they-ensure-there-is-one-electron-on-an-oil-drop-in-millikans-oil-drop-e/87820).
To quote (because it's on a different SE site):
The experiment showed all the drops had discrete amounts of charge. That means, the charges weren't all over the place (any random value). They only had specific values. Some had $2$ or $3$ or $4$ times the charge of others, but it was always some specific value that they had multiples of.
The conclusion was that oil drops didn't seem to pick up "any random amount" of charge, and the reason seemed likely to be because electric charge couldn't be just "any value". There seemed to be some basic unit of a "single electric charge", the smallest value that was found. Some oil drops had $1\times$ or $2\times$ or $5\times$ that charge, but no oil drops had (say) $3.77\times$ or $1.628\times$ that value.
(This isn't strictly correct, because the formula used for friction/viscosity wasn't exactly right, but it gives a good idea how they found the answer. In fact the results led to corrections in that formula.)