So for almost 250 years, there have been legal references to the idea that, legally, as long as the stick that he used was no thicker than his thumb, a husband may beat his wife.
Still, these references always alluded to what people believed, not to any actual established law. While British common law had long accepted that it was perfectly legal for a man to punish his wife in moderation, as you would a servant or child, in the 1765 publication Commentaries on the Laws of England it mentions the idea was already starting to dwindle. That said it seems that nothing was ever laid down in law as to how any such discipline should be applied.
The term rule of thumb has been recorded in use since as far back as 1692, and likely it wasn't a new phrase then. It still means now the same as it meant then - some sort of procedure that has no formal basis but comes from practice or experience.
People attempt to specifically link the phrase with brewing. Before thermometers, it is said that brewers tried to gauge the temperature of the fermenting liquor by using their thumbs. Since the difference in the range of temperatures for fermentation between being too cold and too warm is quite small, and the thumb isn't that sensitive it would seem this link is improbable.
It is more plausible that it would come from the fact that we have often used body parts to take measures of things. There are many of these examples: A foot originally comes from the practice of walking out dimensions; the distance of a yard is roughly as long as it is from the end of your nose to your outstretched fingertips; The height of a horse is still measured in hands (which is the width of the palm and closed thumb); and so on.
It's most likely that the phrase rule of thumb relates to workmen using the distance of their thumbs to measure out roughly an inch. Therefore the word rule in the saying should be taken to mean a ruler to measure rather than indicating a list of rules and regulations.