I have heard that if a child is born out of wedlock, then the child should not be named after the father and the surname of the child should be the mothers surname. But if after the child is born, the mother gets married to the child’s father and changes her surname to the child’s fathers surname. Should the child then get the mothers new surname or the one she had before?
Wa’alaykum as Salām wa rahmatullahi wa Barakatuhu,
If a child is born six months or more from the day that the mother and father married, then the child will be regarded as legitimate and will be attributed to the father.
If a child is born less than six months from the day that the mother and father married, then the child will be regarded as illegitimate and will be attributed to the mother.
Similarly in the case where the mother and father had not married, the child will be regarded as illegitimate and will be attributed to the mother.
Based on the above, the surname of the child should reflect the true attribution of the child i.e., either to the mother or the father.
And Allaah Ta’aala knows best
Ismail Moosa (Mufti)
ولدت ولدا لستة أشهر من يوم تزوجها: فهو ابنه (الهداية – 3/ 346 دار السراج)