The act referred to in the question is impermissible as the sperm was taken before marriage, and the wife at the time the sperm was taken was not lawful for the husband.
Sheikh Ahmad Kutty, a senior lecturer and Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada states: “This is not considered permissible according to the principles of Islam, for the sperm was taken when he was still not married to the woman whose eggs were injected with the sperm. She was therefore not lawful for him at that time.
In Islam, the sperm and the egg must be both extracted and united while the man and woman are lawfully married. That was not the case at the time of extracting the sperm in this case.
A wife, according to Islam, can only be inseminated with sperm that is taken from her husband while she is married to him, and not when they were not lawfully married.”