What is the evolutionary purpose of a fetish? Is it just a mental abnormality that is considered detrimental? I know someone with a foot fetish and I would like to know why that exists.

It would be possible to hypothesise some adaptive explanation I'm sure, but your questions is - in my view - rooted in a common misconception that all variation must be adaptive (i.e. increasese fitness). So I would say that humans exhibit variation in sexual preferences  - from practices we might describe as "fetishes" to ones that we think of as "normal" (for want of a better word!).

In humans - just as in other animals - there is a lot of variation in behaviour, some of which comes from environmental effects (e.g. upbringing, culture, nutrition) and some of which stems from genetic effects. Strong selection on a trait removes genetic variation but not environmental variation.

I don't think there has to be any adaptive explanation for fetishes per se, rather I think it more likely that this variation in behaviour is largely non-genetic in origin, and while I'm sure there are some genetic effects  - my hunch (i.e. this is not tested to my knowledge) is that the strength of selection is pretty weak. For instance, imagine a very overly simplistic hypothetical scenario in which a genetic mutation causes the bearer to have a foot fetish (i.e. a single gene, no env effects). Unless this behaviour actually changes the likelihood of death or expected number of offspring then it is selectively neutral and the frequency of the gene in the population (and hence the number of foot fetishists) will simply drift about in the population. By chance the gene may be lost anyway, or in fact it could (by chance) become so common that the whole population become foot fetishists. In neither case does selection play a role since the trait is neutral for fitness.

agree with all your points Alistair. a couple of additional ones from me.

1. words like "mental abnormality" and "detrimental" are unhelpful in this context - I know of no data to say either is true for any given "fetish", which BTW in itself comes with a very significant societal pejorative overlay.

2. even if we assume there is some detrimental outcome to the INDIVIDUAL of that behaviour it is unlikely to be genetic nor transmissible to the next generation and most importantly is unlikely to affect reproduction and thus it unlikely to have any long term detrimental effect on the population as a whole.