It's not correct to say "an underwear" because "underwear" is an uncountable noun, and the article a/an is for one.
Since "underwear" is an uncountable noun, it's incorrect to say "an underwear" or "a pair of underwear".
Put your underwear on.
Put an underwear on.
Note that we can use a possessive pronoun (my, your, his, etc.) with this word.
If your underwear doesn't fit properly, it's time to replace it.
You can also use other determiners for uncountable nouns, such as some, any, little, etc.
I asked her to put on some underwear.
As mentioned above, it's not correct to say "a pair of underwear".
I have to buy some underwear.
I have to buy a pair of underwear.
And remember, we omit the determiner to speak about something in a general sense.
In my opinion, underwear should be replaced every six to twelve months.