There are two points to be handled in this question,


First
, Islam prohibits adoption but allows Muslims to raise children who are not theirs. Muslims can fully raise these children, look after them, and support them, but the children must be named after their real fathers.
Allah Almighty says: “Allah has not assigned unto any man two hearts within his body, nor has He made your wives who you declare (to be your mothers) your mothers, nor has He made those who you claim (to be your children) your children. This is but a saying of your mouths. But Allah says the truth and He shows the way. Proclaim their real parentage. That will be more equitable in the sight of Allah. And if you know not their fathers, then (they are) your brethren in the faith, and your clients. And there is no sin for you in the mistakes that you make unintentionally, but what your hearts purpose (that will be a sin for you). Allah is Forgiving, Merciful.” (Al-Ahzab: 4-5)
In fact, Islam changed other pre-Islamic traditions related to this issue as well. The raised child cannot inherit from the people who raised him/her, and is not forbidden from marrying what used to be called relatives by the bond of adoption.
Before adoption was prohibited, the Arabs had prohibited the man from marrying the divorcee of his adopted son. Islam prohibits a man marrying the divorcee of his son. However, in Islam, a man can marry the divorcee of the man he raised, who is not his son by blood; this is declared explicitly in the Qur’an. People would have felt uncomfortable in practicing this new permission, if Allah had not selected the Prophet
(peace and blessings be upon him) to demonstrate its acceptability; it’d be a very heavy duty before people, even for the Prophet (peace and blessings be upon him).
Zayd Ibn Harithah (may Allah be pleased with him) was adopted by the Prophet (peace and blessings be upon him) before Islam prohibited adoption. He used to be called Zayd ibn Muhammad (son of Muhammad) until adoption was prohibited, when he was again called after his real father.
Zayd married Zaynab bint Jahsh, the cousin of the Prophet (peace and blessings be upon him). Later on, he had problems in his relationship with her. Allah Almighty inspired to the heart of the Prophet (peace and blessings be upon him) that she would get divorced and he would marry her, something that was hard for him to face other people with. Whenever Zayd complained to the Prophet (peace and blessings be upon him) that his marriage was going from bad to worse, the Prophet (peace and blessings be upon him) always told him to stay with his wife, which is a postponement of what the Prophet learned was going to happen.
the Prophet (peace and blessings be upon him) would not have tried to postpone such matter had it been explicitly said to him as an order from Allah Almighty or as a revelation from Him. It was only an inspiration to his heart. He never hesitated in applying any command from Allah no matter what the issue was.

Zayd eventually divorced Zaynab, and neither one of them knew what Allah Almighty had inspired His Prophet to do. After the waiting period (`Iddah) of Zaynab was over, the Prophet (peace and blessings be upon him) was told to marry her. He sent Zayd himself to ask Zaynab to marry him. Zaynab said that she would not take such a step without a revelation from Allah Almighty. When she went to the Mosque the verses that commanded the Prophet (peace and blessings be upon him) to marry her were revealed, and she married the Prophet.

Allah Almighty says : “And when you said unto him on whom Allah has conferred favor and you have conferred favor: Keep your wife to yourself, and fear Allah. And you did hide in your mind that which Allah was to bring to light, and you did fear people whereas Allah had a better right that you should fear Him. So when Zayd had performed the necessary formality (of divorce) from her, We gave her unto you in marriage, so that (henceforth) there may be no sin for believers in respect of wives of those they raised, when the latter have performed the necessary formality (of release) from them. The commandment of Allah must be fulfilled. There is no reproach for the Prophet in that which Allah makes his due. That was Allah’s way with those who passed away of old – and the commandment of Allah is certain destiny. Who delivered the messages of Allah and feared Him, and feared none save Allah. Allah keeps good account. Muhammad is not the father of any man among you, but he is the Messenger and the Seal of the Prophets; and Allah is Aware of all things.” (Al-Ahzab: 37-40)

The unbelievers and the hypocrites used this event to attack the Prophet (peace and blessings be upon him) and Islam, saying that the Prophet married the divorcee of his son. Even today, this incident is used by the unbelievers to misinform people about Islam and Muhammad (peace and blessings be upon him). These people do not realize the importance of the rule introduced by Islam through this incident. For them adoption is acceptable, and so they find these revelations difficult to grasp or accept.

Adoption is widely practiced in many non-Muslim western societies. Babies are taken from their parents and named after those adopting them. The children grow up having no idea who their real parents are. In a mobile society, an adopted boy may end up marrying his sister from his original parents without knowing that she is his sister. These cases have actually happened. This harmful consequence is one of the reasons that Islam places such importance on the use of the child’s real name. A person’s name is important in Islam because many social rules like marriage, inheritance, custody, provision, and punishment, are contingent upon the blood relationship. This is a reason for women to retain their own names after marriage as well.

Adoption in non-Muslim societies is practiced for many reasons. Non-Muslim societies have many illegitimate babies as a result of extramarital sexual relationships. Very young mothers of these babies do not keep them because they cannot support them and devote time to raising them. So these young women give the children to other parents who have no children, or abandon them in the streets where people can pick them up. Worse than that, some of these babies are killed, put in trash bags, and then thrown in garbage cans.

In other cases, these children are sold to parents who cannot have children. Another reason for adoption in these non-Muslim societies is that many women do not like or want to get pregnant, for fear of ruining their beauty. Many of these people claim that adoption is a humane service. They do not realize that Islam preserves the humane part of this practice by allowing people to raise children that are not theirs, while it prevents the negative consequences of adoption which can harm society by calling the child after the adoptive parents.

Second, The wali is a Muslim man charged with marrying the one under his charge to a man who will be good for her. There is no disagreement that the first wali is her real father if he is Muslim and that the last in line is the ruler. Between those two, there is some disagreement about the order but agreement that they come from the girl’s paternal male relatives – no one from her mother’s side enters into the picture. The order, according to many is: father, paternal grandfather, son, grandson, full brother, paternal half-brother, paternal uncle.