Praise be to Allah.
If a man divorces his wife and the ‘iddah ends, then she is not permissible for him unless there is a new marriage contract, and the wali is one of the conditions of the marriage contract being valid, so marriage is not valid without a wali.
Ibn Qudaamah (may Allah have mercy on him) said in al-Mughni (7/5): Marriage is not valid without a wali, and a woman cannot do the marriage contract for herself or for anyone else, or appoint anyone other than her wali to do her marriage. If she does that, the marriage is not valid. End quote.
The evidence for that is the words of the Prophet (peace and blessings of Allah be upon him): “There is no marriage except with a wali.” Narrated by Abu Dawood (2085) and al-Tirmidhi (1101); classed as saheeh by al-Albani in Saheeh al-Tirmidhi.
As you divorced this woman two years ago, her ‘iddah is over, and after the ‘iddah ends, the ex-husband is a stranger to her like all other men. So she is not permissible to you except with a new marriage contract, and it essential that her wali do this marriage contract, or her wali appoint someone to do the marriage contract with her for you.
If there is no father, then the grandfather is the wali. If there is no grandfather then her brothers are her walis, and it is does not matter if they are younger than her, but it is essential that the wali be an adult. If one of her brothers is an adult then he is her wali, even if he is younger than her.
It says in Fataawa al-Lajnah al-Daa’imah (18/147):
No one can act as a wali for a woman’s marriage contract except one who is an adult of sound mind. If there is no such person then the qaadi (judge) is the wali, because the ruler is the wali of the one who has no wali, and the qaadi is his deputy in such matters. Adulthood is achieved when a person emits maniy with desire, whether as the result of a wet dream or otherwise, or when hair grows around the private part, or when one reaches the age of fifteen. The one who is of sound mind is the one who handles matters well, by seeking a compatible suitor who is appropriate for the female under his care. End quote.
If all her brothers are minors, and none of them is an adult, then the role of wali passes to those who come next, namely the paternal uncles. If there are no paternal uncles then it passes to the sons of the paternal uncles (cousins).
If none of these walis are present, then the shar’i judge should act as wali for her marriage, because the Prophet (peace and blessings of Allah be upon him) said: “If they dispute, then the ruler is the guardian of the one who has no guardian.” Narrated by Abu Dawood (2083) and al-Tirmidhi (1102); classed as saheeh by al-Albani in Saheeh Abi Dawood.
Based on that, if you want to marry this woman and she does not have any wali, then you must refer to the shar’i qaadi in the court so that he may act as the wali for her marriage.
Note: You say that your first marriage was done without any official registration. Even though it is valid if it meets all the conditions – because it is not a condition of a marriage contract being valid that it be registered officially – we should point out that it is important to register marriages, and we advise people not to take this matter lightly, so as to protect people’s rights and so that foolish men and women will not toy with the matter of marriage contracts.
See the answer to question no. 22728.
And Allah knows best.