While this episode is open to interpretation, we can argue that it is related to themes of alienation expressed in Billy Pilgrim's character.
Billy is not in control of his life and, more to the point here, he is out of touch with other people. The idea that Billy is out of step with his society can be seen in his relationships with his daughter and with Roland Weary. It is also symbolically in Billy's time-travel.
This time travel is both a literal science-fiction event and a metaphor for the alienation and dislocation Billy, and contemporary humanity, feel in the face of overwhelming and inexplicable cruelty and violence. (eNotes)
As a contrast to this sense of being socially out of step, when Billy dreams of giraffes he is dreaming that he has finally found a group where he fits in.
It is interesting to note that Billy does not dream of finding a group of people where he fits in, but instead dreams of a group of gawky, "outstanding" creatures. This is the only kind of group where Billy might fit in - a band of other creatures that are out of step with the norm.
The giraffe passage is an interesting one; it reinforces the themes of alienation and apathy.
In Billy Pilgrim's morphine-induced dream, he is a giraffe living among other giraffes. All his giraffe peers are munching on sugar pears, and Billy is eating one as well. He states that the pear is simultaneously hard but juicy in texture. His description is contradictory, of course, which reinforces the surrealistic nature of the novel.
In the story, Billy experiences various scenes of his life in bizarre fashion. Nothing is as it seems, and his "visions" often defy the laws of reality and science. In Billy's giraffe dream, two giraffes approach him from opposite sides. Billy tells us that they are female and that they are "cream and lemon yellow" in color. The friendly giraffes kiss him and appear to accept his presence in the group. Billy relates that the giraffes have "horns like doorknobs" and that these horns are covered in velvet. Then, he abruptly ends his story with a question: "Why?"
Giraffes do not really have horns; they have what are called ossicones, which are formed from ossified cartilage and covered in fur as the giraffes mature. However, the question Billy asks is interesting. Does he want to know why the giraffes appear to have horns or why he's a giraffe in his dream? The giraffe passage reinforces Billy's sense of alienation and confusion. He's considered a part of humanity, yet he strangely feels removed from others. Like his giraffe alter ego, Billy seems to fit into society and even enjoy his interactions with others. However, the meaning of such interactions is unclear to him.
So, the passage reinforces the themes of alienation and apathy in the novel. Because of his war service, Billy Pilgrim witnessed horrific scenes of carnage and bloodshed. Those scenes greatly traumatized him, and he is unable to make sense of his brutal past. Billy's deep sense of helplessness is apparent in almost every one of his stories. When he tells us that one hundred and thirty thousand people will die in Dresden, he is apathetic about what he has just related. His characteristic "so it goes" speaks volumes about how his wartime experiences have skewed his perspective of life and destroyed his sense of self.