We inherit half our genes from each parent, but brothers and sisters don't end up with exactly the same mix (apart from identical twins). One generation later, the mix has been further diluted by marriage, but cousins still share more genes than the general population. If there is a genetic problem in the original family, apparently healthy family members may still carry a recessive gene for that problem. When two carriers of a recessive gene marry, there is a high risk of that gene becoming "active" in their children.
According to my husband, any recessive gene in the original family has one chance in 64 of coming out in the children of first cousins. The problem with most recessive genes is that they can't be spotted beforehand.
But this is modern science, and I suppose church and state based their marriage laws on other factors, including keeping money/land in the family, and whether or not it seemed to them that there were more sickly offspring from cousin marriages. In small non-mobile communities, there was so much intermarriage between families, that the gene pool was very small anyway, so the genetic risk of cousin marriage was less evident.