All perfect praise be to Allaah, The Lord of the Worlds, I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
If the situation is as mentioned, then there is no harm on you for wearing underwear during Hajj or 'Umrah. It might even be that wearing underwear is an obligation during Tawaaf (circumambulation around the Ka'bah) and when doing Sa'i from As-Safaa to Al-Marwah as a means of protecting the place from the possibility of drops of urine falling on the ground.
However, you are obliged to slaughter a sheep for wearing something which is forbidden to wear in principle. An-Nawawi said: 'If a person in a state of Ihraam (either for Hajj or 'Umrah) needs to cover his head, or wear any limb-fitting clothes for a sound reason like heat, cold or treatment, then it is permissible for him to cover but he is obliged to slaughter a sheep." Allaah Says (what means): {.... And whoever among you is ill or has an ailment of the head [making shaving necessary must offer] a ransom of fasting [three days] or charity or sacrifice.}[Quran 2:196]. The ransom as stated in the verse is either to observe fasting, or give charity or offer a sacrifice. The Prophetic Sunnah interpreted this by fasting three days, or feeding six poor persons, or slaughtering one sheep. Imaams Al-Bukhari and Muslim reported that the Prophet told Ka'b Ibn 'Ujrah who had an ailment in his head: 'Shave your head and fast three days, or feed six poor persons, or offer a sacrifice.' A person may offer any of these three options according to his own choice.
Allaah Knows best.