Ultimately the purpose of sexual activity is certainly reproduction. Survival of the individual is pointless from an evolutionary point of view if offspring are not produced. All living things die. Without reproduction, the species will join the majority of species that have lived on earth and become extinct. However, that said, sexual activity in mammals serves other purposes than ‘ just’ reproduction.
Sexual activity in mammals comes in a variety of forms and can be quite complicated. It is not just a matter of the old ‘slam, bam, thank you mam’ behaviour because in most mammals, females are choosy and will not accept the attentions of just any old male. Males have to prove themselves first. Thus much preliminary sexual activity is designed to prove the fitness of the individual, help him reach the top of the social pecking order and demonstrate to the members of both sexes that the individual is a good mate choice.
Take Blue Grouse for instance. These birds live in the American Pacific Northwest. Males have to establish and hold territories in areas considered suitable for nesting by the females. They do this by strutting and showing off beautiful yellow or red patches of skin over the eyes and on the throat. They have to chase off other males and attract females to come into their territories and mate. All this takes a lot of time and the end result of mating may only last a few seconds. But without all that buildup, the females would have never accepted the male.
Blue Grouse are polygamous and the males take no part in nest building or the rearing of young. In species that mate for life or at least for the duration of a breeding season and share parental duties, sexual activity is used to strengthen the pair bond. When penguins return from the sea after feeding trips, they call across the colony to locate their mate. When they find each other, there is much billing and cooing, displaying and sexual behaviour that may or may not end in an actual mating. Here the purpose is to create and strengthen bonds in the couple so that when the young finally arrive, both parents are committed to maintaining the partnership till the young are ready to strike out on their own.
In many social species, sexual activity is used to strengthen the ties between the members of the group. Females of many monkey species are promiscuous and use sexual activity to encourage the males to stay in the group and protect it. Sexual activity can also be used to prevent aggression. Weaker animals of both sexes will often roll over and offer themselves sexually in order to prevent more dominant animals from attacking them. This can be seen in dogs, wolves and other social carnivores.
Masturbation is another form of sexual activity that obviously cannot be for reproduction. It is not all that common but I have seen it in male elephant seals that are too young and small to compete for females on the breeding beaches. These animals are mature sexually and their frustration is often pretty obvious to the observor. I have seen them rub themselves against sand, rocks and other animals, presumably for the sensual satisfaction and relief that this provides.
Ultimately of course all sexual activity must lead to reproduction or it has all been a waste of time. However in the short term, some overtly sexual activities have other purposes than just reproduction.