Praise be to Allaah.
Our shaykh ‘Abd al-Rahmaan al-Barraak answered this question as follows:
“Underwear and other types of clothing have to do with habits based on people’s traditions (‘urf), so long as they do not contradict the sharee’ah. The wearing of pants (sirwaal) was known at the time of the Prophet (peace and blessings of Allaah be upon him) because of the hadeeth of Ibn ‘Umar (may Allaah be pleased with them both) concerning what the muhrim (person in a state of ihraam for Hajj or ‘Umrah) is forbidden to wear: ‘The muhrim should not wear a shirt or turban or pants…’ (Agreed upon).”
There is nothing wrong with wearing underwear so long as it does not involve anything that is haraam, such as crosses or pictures of animate beings, or women wearing men’s clothes and vice versa.