It says in the verse, “If I forget you, O Jerusalem, let my right hand forget its skill. Let my tongue adhere to my palate if I fail to recall you, if I fail to elevate Jerusalem above my foremost joy” (Psalms 137). Therefore, even at times of "foremost joy" such as a wedding, we smash a glass in order to recall the Temple and the glory of Jerusalem during The Temple era and regret its destruction.
On the other hand, the fact that we break the glass at this time of union between husband and wife as they unite to build a new home, symbolizes and expresses our hope that G-d and the Jewish people will also soon unite to rebuild the Temple and restore their former intimacy and glory.
Another reason is based on the Talmud in Berachot: "[The Torah] says 'Serve God with fear and rejoice with trembling'... Rav Ashi made a wedding for his son. When he saw that the Rabbis were getting 'carried away' in their rejoicing, he brought out a crystal glass and broke it before them and they became more solemn."
The authors of the Tosefot state that this is the source for the breaking of the glass at weddings. We learn from this that even at an occasion of great rejoicing, one must take measures to ensure that the celebration remains within bounds of propriety and holiness.
Shulchan Aruch, Orach Chaim 560:2
Berachot, pages 30b-31a
Tosefot - Berachot, 31a, "Aissi...."