Praise be to Allah.
We praise Allaah for having enabled you to repent and guided you, and diverted evil from you, and we ask Him to grant you more and make you steadfast.
You should choose a righteous person from among your family or your wife’s family to try to bring about a reconciliation between you, and to convince your wife to give up the idea of seeking a divorce, for the sake of her home and her daughters.
You have the right to keep her and to refuse to divorce her, and to tell her that you want to continue to live together.
The wife does not have the right to ask for a divorce or khula’ unless there is a reason for that, such as if she has been harmed, because the Prophet (peace and blessings of Allaah be upon him) said: “Any woman who asks her husband for a divorce when it is not absolutely necessary, the fragrance of Paradise will be forbidden to her.” Narrated by Abu Dawood (2226), al-Tirmidhi (1187) and Ibn Majaah (2055); classed as saheeh by al-Albaani in Saheeh Abi Dawood.
But if the qaadi rules that there should be a divorce or khula’, this depends on what reasons the wife has given.
In the event of divorce, the mother retains custody of the children until they are seven years old, so long as she does not marry again, because of the report narrated by Ahmad (6707) and Abu Dawood (2276) from ‘Abd-Allaah ibn ‘Amr (may Allaah be pleased with him), that a woman said: O Messenger of Allaah, my womb was a vessel for this son of mine and my breasts gave him to drink, and he rested in my lap. But his father has divorced me and wants to take him from me. The Messenger of Allaah (peace and blessings of Allaah be upon him) said to her: “You have more right to him so long as you do not get married again.” Classed as saheeh by al-Albaani in Saheeh Abi Dawood.
When the child reaches the age of seven, if male he should be given the choice between his parents and he should live with the one who is dearest to him. With regard to a female, there is a difference of opinion among the scholars:
Al-Shaafa’i said: She should also be given the choice.
Abu Haneefah said: The mother has more right to her, until she gets married or menstruates.
Maalik said: The mother has more right to her until she gets married and her husband consummates the marriage with her.
Ahmad said: The father has more right to her because the father is the best one to look after her.
See: al-Mawsoo’ah al-Fiqhiyyah (17/314-317).
In view of these differences and the fact that there is no decisive text about this in the Sunnah, the matter should be referred to a shar’i qaadi (judge) to determine who the daughter should live with when she reaches the age of seven.
We ask Allaah to set our affairs and those of all the Muslims straight.
And Allaah knows best.