A native speaker will distinguish these most often simply by context. In the rare cases when the context is not useful, the pronunciation is slightly different, so it will still be possible to understand which one was intended.
- élégant is pronounced [e.le.gɑ̃]
- et les gants is pronounced [e.lɛ.gɑ̃]
Note that the pronunciation of les might differ in some regions. In that case, both phrases might sound exactly the same indeed. But again, the context of the conversation is key here.
They are homophones. Most languages have homophones, French is no exception. The pronunciation is the same: [e.le.gɑ̃]. (Sometimes les may be pronounced [lɛ], i.e. with an open è sound instead of the semi-open é sound, but the proximity of the word et which is always pronunced with the semi-open sound tends to force les to [le].) Usually you can tell from the context.
If you’re speaking and you absolutely need to make the difference audible, you can make a slight pause between the words and stress gants to indicate et les gants, and make a slight pause before the word and stress the first syllable or the first two syllables to indicate élégant.
Sometimes, when the phonetic ambiguity is really problematic, French people may resort to spelling orally. For example, la symétrie and l’asymétrie are antonyms; if there is a risk of confusion, then we could go as far as saying “la, plus loin, symétrie” (but more often we would just make a clear pause between la and symétrie) and “el apostrophe asymétrie” (but more often pronouncing [l], then a pause, then asymétrie).