Cousin marriage was prevalent all over the world with the big exception of western Europe . It still is especially common in the Islamic world. Marrying your relatives has the advantage of keeping the family together. Clans of up to several hundred closely related persons are the result and especially in a pre-state context, that is a pretty useful organisational unit. However, from a genetic or evolutionary perspective there are several potential problems with cousin marriage.
The obvious one is the prevalence of homozygosity runs, i.e. sections in the genome that are identical for the chromosome coming from the father and the chromosome received from the mother. These are generally problematic, because the other chromosome copy has to step in whenever something is significantly messed up in one chromosome. Homozygosity runs mean that mutational load hits with full force for some sections of the genome. There is probably an IQ loss of several points and congenital diseases become much more common.
However, all problems caused by homozygosity runs can be fixed by a single outbreeding event. But what if living in a clan environment has reduced the selection for individual achievement in a population for hundreds of years? The welfare state is often blamed for the reduced or reversed selection for positive traits, but a clan is a form of welfare state. The clan provides you with a job, a wife, takes care of you when you fall ill or lose your ability to feed your kids. It is conceivable that the existence of clan structures prevented the slow replacement of the lower class by the middle class that is conjectured to have raised the IQ in Europe until the nineteenth century .
Clan borders also work to a certain degree as genetic barriers. This means that positive mutations have a much harder time sweeping the population. If the default is marrying a relative, a positive mutation will have to sweep each clan separately and additionally jump from clan to clan.
The fourth potential problem I see is a reduced response to selection. Response to selection depends on the variance of the trait in question. Variance within each clan (not necessarily within the full population) will be lower for two reasons: The reduced genetic diversity and less assortative mating. Depending on how the selection pressure is structured this might reduce the speed of genetic adaptation.
It is possible that these four factors played a role in the precipitous fall of intellectual productivity that the Islamic world has experienced since the Islamic Golden Age .
 Cousin marriage Europe
 Farewell to alms
 Cousin marriage Middle East