I heard something a while back suggesting that so-called “perfect pitch” is an ability most of us are born with*. That is, we’re generally able to reproduce a specific note right on. Pick a song you know well and start singing it - you’re probably right on tune with the original. The other example they used was Chinese and other tonal languages, where the pitch you use changes the meaning. So this ability that we westerners think of as very musical could be part of our ability to use language.
*What is unusual about perfect pitch as we know it is the ability to connect specific notes to specific labels. My brother, for instance, can hear a fan and tell you it’s humming in B flat. Or if we ask him for a C, he can accurately hum one. According to the researchers, this is something many more of us could probably learn when young, but don’t.
Best friend and husband are both entirely incapable of singing, whistling, or humming in tune. They can follow a tune - sort of, in that they can tell generally when the notes are going up or down, but there is no indication that they are aware that specific notes or intervals between them exist.
My husband is even less capable because he’s got no rhythm either - he can’t keep a beat to save his life, or even keep metric time in poetry or songs.
They are both musical, but it’s a little excruciating for one of my friends, who DOES have perfect pitch, and gets really freaked out when they sing or hum or whistle.
He said it’s really hard to explain why it’s so bothersome, but he compared it to a combination of fingernails on a chalkboard, combined with someone doing something totally WRONG on a fundamental level - like using a dirty shoe as an eating utensil or something.
Even the dog leaves the room when I try to whistle a tune.
My youngest was 14 before he figured out how to whistle.
No, most people whistle out of tune, me included.
Wow - I was probably 15 before I learned how to whistle. I remember trying and trying, then practicing once I finally figured out how to do it. I still can’t whistle a tune completely or very well at all - I’ll get the first notes, maybe, enough for you to possibly guess the tune, but it’s pretty slow and tentative.
Maybe I should practice more on my drives home. Hey, it’s a half hour I’m not using for anything else, so there is that.
I play saxophone, but I can’t whistle. What does that say about me? 
Our ability to whistle is probably fortuitous, and is an indirect result of the fine control we have over our lips and mouth which we acquired in connection with using speech as a mode of communication. I think it’s unlikely it was selected for directly.
However, once it was acquired it would have been useful in several ways, especially for signalling over distances by hunting parties or foragers. Our musical ability in general is probably connected with promoting group cohesion.