Is it permissible for a woman whose husband is completely sterile to use a sperm bank (a repository of sperm samples from various men that are frozen and then donated to those who need it) to fertilize her ovum in order to have children?
It is not permissible for a man to transfer sperm to the uterus of a woman other than his wife for fertilization inside the womb. It is permissible if the fertilization [of the wife’s ovum with her husband’s sperm] takes place in a test tube and the fertilized ovum is then implanted in the womb of someone other than the wife, although this should be avoided based on recommended precaution.
In both cases, the child is legitimate. As for lineage, the sperm donor is the father, whereas it is problematic to identify either the ovum-donor or the woman who carried the child during pregnancy as the mother. Therefore, precaution must be observed in terms of the religious rulings related to the male offspring’s status as brother and/or son. However, the child and the woman who carried the pregnancy are mahram to each other even if he might not be technically considered her son.