When the Ansar performed Hajj and returned, they would not enter their houses through the front doors but only from the back. A man from the Ansar came and entered through his front door, and he was criticized for this. Then this verse was revealed, "It is not righteousness that you enter houses from their backs" [Baqarah 2:189].
حدثنا أبو بكر بن أبي شيبة حدثنا غندر عن شعبة ح و حدثنا محمد بن المثنى وابن بشار واللفظ لابن المثنى قالا حدثنا محمد بن جعفر عن شعبة عن أبي إسحق قال
كانت الأنصار إذا حجوا فرجعوا لم يدخلوا البيوت إلا من ظهورها قال فجاء رجل من الأنصار فدخل من بابه فقيل له في ذلك فنزلت هذه الآية {وليس البر بأن تأتوا البيوت من ظهورها}