We were with the Prophet ﷺ on a journey during a dark night, and we could not tell the direction of the qiblah, so each one of us prayed facing whichever way he was. When morning came, we mentioned this to the Prophet ﷺ, and the verse was revealed, "So wherever you turn, there is the face of Allah" [Baqarah 2:115].
حدثنا محمود بن غيلان حدثنا وكيع حدثنا أشعث بن سعيد السمان عن عاصم بن عبيد الله
كنا مع النبي ﷺ في سفر في ليلة مظلمة فلم ندر أين القبلة فصلى كل رجل منا على حياله فلما أصبحنا ذكرنا ذلك للنبي ﷺ فنزل {فأينما تولوا فثم وجه الله}
[Its chain of transmission is daif] Ibn Majah recorded it in the Book of Establishing the Prayers, in the chapter titled "One Who Prays Facing Other Than the Qibla Without Knowing It," hadith no. 1020, from the hadith of Ashath Samman with the same wording, and Amr bin Qays followed him as narrated by Abu Dawud Tayalisi, hadith no. 1145.Asim bin Ubaydullah is daif (Taqrib).The hadith has daif corroborating narrations found in Bayhaqi, Ibn Mardawayh, and others. See Tafsir Ibn Kathir, 1/163, and elsewhere.