Does something have to have a purpose if it's enjoyable and it harms no one else?
To now totally contradict my point, let me point out two things.
1. Having fun and relaxing actually serves a vital biological function, otherwise you would literally keel over dead from stress. I'm not putting sex (mutually consenting adults of any configuration) into a box of merely a "fun and relaxing activity" because obviously there is a lot more going on emotionally, socially and intellectually in most sexual encounters within either a short or a long term relationship.
However, one aspect of sex IS that it's fun and relaxing, therefore it's performing a really important biological function right there on the participants involved. Medical scientists will now put their hand on their heart and swear that having sex is actually really good for your health, it releases so many positive endorphins, and eases pain. Improving your health is an important bilogical function, right?
2. No animals except for humans have the menopause. Every other animal stays fertile, right up to the point where it's killed and eaten, or drops dead on it's own. Archeologists and biologists have noticed that the point in human history when humans started to have the menopause co-incided with a great upswing in human technology and brain-size. They tentavely concluded that having adults around who had no children of their own was a great benefit to the community as a whole.
Older, experienced adults who were not hampered by their own children could put time into doing other productive things, and into teaching others. They could also teach and mind children, freeing up fit parents for more strenuous activities.
Obviously having a population that is exclusively homosexual isn't going to work (without IVF!) but you can see how homosexuals and bi-sexuals fit into that historical picture, can't you? By having less children of their own, they join the ranks of the grandparents and other childless adults. They are freed up from 24 hour a day responsibility from minding their own children, and can use that time very productively elsewhere, bringing in more resources to the community as a whole.
They are also a valuable adult resource for other people's children, someone to go to when their own parents are busy, or incapacitated, or dead.