Sayyiduna al-Bara' (may Allah be pleased with him) said: When the Ansar returned from Hajj, they would not enter their houses through their doors, but would come in from the back. A man of the Ansar came and entered through the door of his house, and he was reproached for it. Then this verse was revealed: "It is not righteousness that you enter houses from their backs, but righteousness is (in) one who fears Allah. And enter houses through their doors." [Surah al-Baqarah: 189]
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الحج / 10379