Hating Girls is a Thing From Jahiliyyah
Question :
We have heard in these times from some people things which cause argument and surprise, such as people saying: "We do not like our wives to give birth to girls." And some of them say to their wives: "By Allah, if you give birth to a girl, I will divorce you!" We declare our innocence to Allah of them. And one sees some women in deep despair due to her situation. How and what should she do regarding what her husband says, and does Your Eminence have any advice concerning it?
Answer:
I think that what this brother says is very, very rare, and I do not believe that anyone's ignorance would reach the level that he would threaten his wife with divorce if she gave birth to a girl. Unless he was tired of his wife and wished to divorce her, so he used this as an excuse to do so. Because if the matter was thus, and he could not bear to be with her and he tried to stay with her, but he could not, then he may divorce her. in a manner other than this. Because there is no objection to divorce when it is necessary.
Having said that, we advise everyone who sees something objectionable in his wife to be patient, as Allah, Most High says:
"If you dislike them, it may be that you dislike a thing through which Allah brings a great deal of good."
As for hating daughters, there is no doubt that it is something from the Jahiliyyah and that it contains an element of displeasure with Allah's Ordainment and His Decree. A man. does not know, it could be that a daughter is better for him than many sons. How many daughters have become a blessing for their fathers in his life and his death? And how many sons have become a misfortune and trial for their fathers in their lives and have not brought them any benefit after their death?
Source:
Ibn 'Uthaimin
Fatawa Islamiyah, Vol. 5 Pages 450-451