I glue my frets in with LMI Instrument Maker's Glue, which is a variant of Titebond. The purpose of the glue isn't to help hold the frets in. It's to completely fill the gap in the slot around the fret tang and seal up the wood against moisture. Pressing /hammering the fret in forces the glue into the end grain on the side walls of the slot.
Moisture seeping in around the frets and sinking into the end grain in the slots causes the wood to swell. That pressure, applied against all the frets along the neck, is the biggest cause of necks bending when the humidity goes up. Short term instability, truss rod adjustments, etc. And when that wood next to the fret swells, it also tends to push the fret up. And when the weather dries up again, the frets are raised up and loose.
So, in a roundabout way, gluing the frets in helps keep the frets down and tight.
Like Beej said, the glue also helps lubricate the slots and the frets go in easier and seat better.