Yip Harburg, known to posterity as "Broadway's social conscience," was both a skilled writer of pop songs and a life-long socialist and activist. Most of his songs were devoid of any serious political content, but some could be interpreted allegorically.
We think it's possible to read "Over the Rainbow" as an allegory (some have interpreted it as an allegory for the experience of closeted gay people, for example), but, in this case, the technique might be much simpler. On the most basic level, "Over the Rainbow" is a song about a theme that many people can identify with: the desire to be in another place. It also sets the stage, as we all know, for a grand adventure to come.
"Over the Rainbow" is the first song in The Wizard of Oz, and it comes just after young Dorothy Gale is rejected and yelled at by her aunt and uncle and falls into a pigsty. Dorothy is worried about her evil neighbor, who doesn't like her dog, Toto. The emotion expressed is that of a young girl, worried and alone, longing to leave her isolated Kansas home for someplace better.
"Over the Rainbow" may be metaphorical, but we are guessing it's mostly about showing that Dorothy's young mind longs for simple things: blue skies, no worries, and birds singing. Rather than creating a pointed allegory, we think Yip Harburg created a classic song on the timeless topics of longing and escape.