Al-Kāfi

Hadith 1417
marriage
3- مُحَمَّدُ بْنُ يَحْيَى عَنْ أَحْمَدَ بْنِ مُحَمَّدٍ عَنْ عَلِيِّ بْنِ الْحَكَمِ عَنْ عَلِيِّ بْنِ أَبِي حَمْزَةَ عَنْ أَبِي بَصِيرٍ عَنْ أَبِي عَبْدِ اللهِ (عَلَيْهِ السَّلام) قَالَ سَأَلْتُهُ عَنْ رَجُلٍ فَجَرَ بِامْرَأَةٍ ثُمَّ بَدَا لَهُ أَنْ يَتَزَوَّجَهَا فَقَالَ حَلالٌ أَوَّلُهُ سِفَاحٌ وَآخِرُهُ نِكَاحٌ أَوَّلُهُ حَرَامٌ وَآخِرُهُ حَلالٌ.
3. Muhammad ibn Yahya has narrated from Ahmad ibn Muhammad from Ali ibn al-Hakam from Ali ibn abu Hamzah from abu Basir who has said the following: “This is concerning my question before abu ‘Abd Allah (a.s.), about the case of a man who commits an indecent act (goes to bed with her out of wedlock), then decides to marry her. He (the Imam) said, ‘It is lawful, although in the beginning, it is indecency, and at the end is marriage; in the beginning, (it is) unlawful and in the end becomes lawful.’”
Source: Shaykh Muḥammad b. Yaʿqūb al-Kulaynī