Always ask about pronouns.
Using the wrong pronoun for someone can be really awkward for the person making the mistake. But for the person being mis-gendered, it's yet another incident reminding them that most people don't understand their gender. It's frustrating and demoralising and a lot of trans people put up with it day in, day out. Over time, it gets very upsetting.
It's good practice to ask everyone, in whatever setting or environment, what pronouns they use, just as you'd ask their name. Don't assume that you can guess, or that you'll know if someone uses different pronouns to those you might assume from their appearance - you can't know!
Asking which pronouns someone would like you to use is not offensive. A good way to do it is to introduce yourself using your own pronouns - "Hi, I'm x, and I use x pronouns; may I ask what pronouns you use?"
Using the right pronouns is really important, so once you've been told, make a real effort to get it right! If you slip up, well, it happens. Just apologise, correct yourself, and then get on with the conversation.
'He / him / his' and 'She / her / hers' are not the only pronouns out there, so don't be surprised if someone asks you to use something different. People who don't identify with a binary gender quite often use other pronouns, like 'They / them / theirs' and 'Ze / hir / hirs'. For a more comprehensive list and more info, go here.
Content Warning: this page includes discussion of misgendering.