Abdullah bin Abbas reported,

A woman among the Ansar would often have her children die young, so she would vow that if a child of hers lived, she would raise him as a Jew. When Banu al-Nadir were expelled, there were among them some sons of the Ansar.The Ansar said, "Messenger of Allah, what about our sons?"So Allah revealed this verse, "There is no compulsion in religion" [Baqarah 2:256].Saeed bin Jubayr said, "Whoever wished joined them, and whoever wished entered Islam."

Azami 161

Sahih

في قوله تعالى: {لا إكراه في الدين} [البقرة: ٢٥٦]

عن ابن عباس قال

كانت المرأة من الأنصار لا يكاد يعيش لها ولد فتحلف: لئن عاش لها ولد لتهودنه. فلما أجليت بنو النضير إذا فيهم ناس من أبناء الأنصار. فقالت الأنصار: يا رسول الله، أبناؤنا، فأنزل الله هذه الآية {لا إكراه في الدين}. قال سعيد بن جبير: فمن شاء لحق بهم، ومن شاء دخل في الإسلام.

الأعظمي 161صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Faith
Chapter
Qualities of faith
Section
No compulsion in religion
Numbering
Jami al-Kamil 161 (2nd edition)
Azami 161