There are advantages and disadvantages to marrying closely (like a first cousin). Sometimes the advantages, such as having greater trust, might outweigh the disadvantages. To my understanding, occasional close marriages are not usually a problem with genetics, rather, problems tend to arise when people do this over a long span of generations. Also they have been common in many cultures not just among some Muslim cultures. Genetic problems can also arise in any marriage. However there is nothing in Islam recommending this particular type of marriage.