Referring the question to Sheikh Ahmad Kutty, a Senior Lecturer and an Islamic Scholar at the Islamic Institute of Toronto, Ontario, Canada, he sated,
The questioner can marry the mother of child as long as she has repented of her sins and remains chaste. By marrying her, you are providing the son, born of your common law relationship, the benefit of a father. As long as she was not married to someone else when you associated with her, if you fathered the child, the child will be yours. So, you may marry her to resolve the issue of your son’s identity.
Having said this, I must also urge the questioner to repent to Allah of the previous sins and to practice Islam. Allah may guide her to Islam, and thus save both your son and wife.