Praise be to Allah.
It is not permissible for a woman to seek divorce unless she has a reason that makes that permissible, such as bad treatment on the husband's part, because of the report narrated by Abu Dawood (2226), at-Tirmidhi (1187) and Ibn Maajah (2055) from Thawbaan (may Allah be pleased with him) who said: The Messenger of Allah (blessings and peace of Allah be upon him) said: Any woman who asks her husband for a divorce for no good reason, the fragrance of Paradise will be forbidden to her.
Classed as saheeh by al-Albaani in Saheeh Abi Dawood
If there is a valid reason, it is permissible for her to ask her husband for a divorce and if he refuses, she may refer the matter to the Islamic judge. If there is no Islamic judge, then she should refer to the Islamic Centre in her city.
If the divorce is given by the husband or through the Islamic Centre, it is permissible to document it in the civil courts that do not rule according to shareeah.
But if the husband refuses to give a divorce and the civil court issues a divorce, this does not count as a talaaq, because a divorce issued by a kaafir judge does not count as such.
The fuqaha' are unanimously agreed that the Islamic stipulations concerning the judge who judges between Muslims must be a Muslim, because passing judgements comes is a kind of wilaayah (authority), and the kaafir has no authority over a Muslim.
This has been discussed previously in the answer to question no. 127179, in which we stated that if a woman obtains a civil divorce, she should take it to the Islamic Centre and show it to scholars who are qualified in such matters in order to complete the matter in the manner prescribed in shareeah.
If the divorce was completed in the prescribed shari manner, the mother retains custody of the children until they reach the age of seven years, so long as she does not remarry, because of the report narrated by Ahmad (6707) and Abu Dawood (2276) from Abdullah ibn Amr (may Allah be pleased with him), according to which a woman said: O Messenger of Allah, this is my son; my womb was a vessel for him, and my breasts gave him to drink, and my lap was a protection for him. His father has divorced me and he wants to take him away from me. The Messenger of Allah (blessings and peace of Allah be upon him) said: You have more right to him so long as you do not remarry.
This hadeeth was classed as hasan by al-Albaani in Saheeh Abi Dawood.
When the child reaches the age of seven years, in the case of a male, he is to be given the choice between his parents, to choose which of them he prefers to stay with. With regard to the female child, there was a difference of scholarly opinion concerning the matter.
Ash-Shaafai said: She should also be given the choice.
Abu Haneefah said: The mother has more right to custody of her until she gets married or starts to menstruate.
Maalik said: The mother has more right to custody of her until she gets married and the husband consummates the marriage with her.
Ahmad said: The father has more right to custody of her, because it is more appropriate for the father to take care of her and protect her.
See: al-Mawsooah al-Fiqhiyyah, 17/314
This applies if both partners are fit to have custody; if one of them is not fit to have custody because he is an evildoer, for example, then custody is given to the other party.
This matter should be referred to a trustworthy Islamic authority in your country, to examine the husband's situation and the age of the child, and determine who is more entitled to custody of him.
And Allah knows best.
Reproduced from Islam QA