The willow tree song that Desdemona sings tells the story of a maid who dies because of love, of a broken heart. As Desdemona sings it, the song merges into her own story, although she has no awareness that she will die soon, too, because of Othello's jealous love. So, on the most obvious level, the song functions as foreshadowing.
The willow tree is a popular symbol of sadness, often called the "weeping willow." As we tend to lean downward, in a slump, when we are sad or depressed, the tree, leaning downward, resembles a person in sadness. Also, because of the way the branches look, the tree resembles a long-haired female leaning over, hiding her face in sadness. There was a popular song in, I believe, the 1940's, called "Willow, Weep for Me," and I would guess that the willow has been used fairly frequently over the last several hundred years. For example, in the King James Version of the Bible, we have this:
By the rivers of Babylon, there we sat down, yea, we wept, when we remembered Zion.
We hanged our harps upon the willows in the midst thereof.
Other versions of the psalm reference poplars, so it is not at all clear what the original Hebrew was, but it is interesting to think that the willow was a symbol of sadness thousands of years ago.
Desdemona's choice of this song shows us her sadness and gives us a sense of foreboding, not only because of the fate of the maid in the song, but also because the song relies heavily on the willow as a symbol of grief and sadness. We can see the parallels between the song and Desdemona's life, and we know things are not going to turn out well.