I heard the Messenger of Allah ﷺ say, "Trousers may be worn by one who cannot find a waist-wrapper, and leather socks by one who cannot find sandals."
حدثنا سليمان بن حرب حدثنا حماد بن زيد عن عمرو بن دينار عن جابر بن زيد
سمعت رسول الله ﷺ يقول السراويل لمن لا يجد الإزار والخف لمن لا يجد النعلين
Muslim narrated it in Hajj, in the chapter on what is permissible for someone in the state of ihram for Hajj or Umrah to wear and what is not permissible, and so on, hadith 1178, from the hadith of Hammad bin Zayd. Bukhari narrated it in Jaza al-Sayd, in the chapter on wearing khuffs for the muhrim when he cannot find sandals, hadith 1841, from the hadith of Amr bin Dinar, with the same wording.