Hadith.3533 - Zurarah narrates from one of the Imams (as), peace be upon them, that Imam (as) said regarding a foundling:
"She is free and cannot be bought or sold. However, if a child is born to you from her through unlawful relations, then you may keep or sell the child if you wish, as he is your slave."