He wants to attribute his child from his second wife to his first wife, because she cannot have children. What is the ruling?
Question

I am married and my wife no longer gets her menses. Is it permissible, according to Islam, to marry another wife with the aim of taking an egg from her and implanting it in the uterus of my current wife, and producing a child who will be kept by my current wife, and we will attribute him to us? If that is not permissible, is it permissible for me to marry a woman so that she will bear me a child in the natural way, and I will attribute him to myself and my current wife, after his birth mother agrees to that?
Praise be to Allah.Firstly: 
The first idea, of implanting an egg from one woman into the uterus of another woman, is not permissible. A statement was issued by the Islamic Fiqh Council concerning the issue of implanting a fertilised egg from a couple into the uterus of another woman, stating that this is not permissible, even if the woman in whom the egg is implanted is the second wife of the husband himself. For information on the statement of the Council, please see the answer to question no. 23104 . 
Secondly: 
The child can only be attributed to his real parents. Allah, may He be exalted, says (interpretation of the meaning):
“nor has He made your adopted sons your real sons. That is but your saying with your mouths. But Allah says the truth, and He guides to the (Right) Way.
Call them (adopted sons) by (the names of) their fathers, that is more just with Allah” [al-Ahzab 33:4, 5]. 
Based on that, it is not permissible to attribute the child to anyone but his real mother who gave birth to him. This is the kind of adoption that is prohibited. That is because attributing him to someone other than his real mother may result in negative consequences, one of which is that he would inherit from that woman on the basis that she is his mother, when in fact she is not, and this would be a transgression of people’s rights. Moreover, people may regard that child as a mahram of someone for whom he is not a mahram, such as a maternal uncle or aunt, or vice versa. 
Conclusion: 
It is not permissible for you to seek to have a child in the manner mentioned. It is also not permissible for you to marry another woman so that you can attribute her child to your first wife. 
You have other, permissible means of having a child, such as marrying a second wife. In that case, if Allah blesses you with children from her, there is no reason why the first wife cannot take care of the upbringing of some of the children of the second wife, as a way of bringing her comfort and consolation by having children around her. If it is not possible to marry a second wife, but you can take care of an orphan, then we advise you to try to do that, but without attributing the child to yourself or to your wife, unless she actually gave birth to him. 
For more information, please see the answers to the following questions: 126003 , 10010, 97087
We ask Allah to bestow upon you righteous offspring, for He is able to do that. 
And Allah knows best.