How do cultural influences lead to genetic changes in populations

In Europe a long time ago, inbreeding was a commonly accepted practice within royal blood lines. So, generations of one family's tree would have the same recurring recurring genetic defects. There is a village in Spain in which most of the inhabitants have extra/fewer fingers and toes than is to be expected because of intermingling with blood relatives. So, in places where incest is not looked down upon with disdain, this could affect genetics.