As far as Shari`ah is concerned, it is not permissible for males to put on underwear or any sewn clothes in a state of Ihram. however, if someone has a specific medical condition that necessitates wearing underwear, then it would be considered as permissible in lieu of necessity.

In his response to this issue, Sheikh Ahmad Kutty, an Islamic scholar states:

“Generally speaking, it is not permissible for males to wear any sewn clothes and therefore it would be a breach of the rules of ihram to wear underwear. However, if someone has a specific medical condition that necessitates wearing underwear, then it would be considered as permissible in lieu of necessity (darurah).
If it is simply due to the concern of exposing one’s nakedness (`awrah), it is possible to guard against this possibility by wearing belts or pins to keep the two pieces of ihram as tight and firm as possible so that they do not come off easily.
If, however, someone wears sewn clothes such as underwear without any genuine excuse, then he has violated the conditions of ihram. He must therefore offer a compensation by offering a sacrifice, feeding six persons, or fasting three days).”