The Messenger of Allah ﷺ said, "Allah created the creation, and when He had finished, the womb stood up and said, 'This is the place of one seeking refuge with You from being severed.'Allah replied, 'Yes. Are you not pleased that I should maintain ties with whoever maintains ties with you, and sever ties with whoever severs you?'The womb said, 'Indeed, I am.'Allah said, 'Then that is yours.'"Then the Messenger of Allah ﷺ said, "Recite, if you wish, 'Then is it to be expected of you, if you were given the authority, that you would do mischief in the land and sever your ties of kinship? Such are the men whom Allah has cursed, for He has made them deaf and blinded their sight. Do they not then ponder over the Quran, or are there locks upon their hearts?' [Muhammad 47:22–24]."
قال رسول الله ﷺ: إن الله خلق الخلق حتى إذا فرغ منهم قامت الرحم فقالت: هذا مقام العائذ من القطيعة. قال: نعم، أما ترضين أن أصل من وصلك وأقطع من قطعك؟ قالت: بلى، قال: فذاك لك، ثم قال رسول الله ﷺ: اقرؤوا إن شئتم: {فهل عسيتم إن توليتم أن تفسدوا في الأرض وتقطعوا أرحامكم أولئك الذين لعنهم الله فأصمهم وأعمى أبصارهم أفلا يتدبرون القرآن أم على قلوب أقفالها}.
Bukhari narrated it in his tafsir (4831) and Muslim in Chapters on Kindness and Maintaining Ties (2554), both through Hatim bin Ismail, from Muawiya bin Abu Muzarrid, client of Banu Hashim, who said, my uncle Abu Hubab Saeed bin Yasar narrated to me, from Abu Hurairah, and he related it.The wording given is Muslim's, for Bukhari did not present the full wording with this chain of transmission but instead referred back to the chain preceding it.