The husband gets angry when his wife gives birth to a girl
Question

Some of the Muslims, may Allaah guide them, get angry when Allaah blesses them with daughters, and they get very upset when a daughter arrives. I also know someone who has threatened to divorce his wife if she produces a daughter. I hope that you can shed some light on this topic from the point of view of Islamic sharee’ah.
Praise be to Allah.Undoubtedly this action is one of the deeds of the first Jaahiliyyah, from the conduct of its ill-mannered people, those who were blamed and condemned in the Qur’aan and Sunnah.
How similar things are today to those times. If you visit any maternity hospital in a Muslim country, and look around at the faces of those to whom daughters have been born, listening to what they say and seeing how they are, you will see a strange similarity between many of these people and the people of the Jaahiliyyah, of whom Allaah says (interpretation of the meaning):
“And when the news of (the birth of) a female (child) is brought to any of them, his face becomes dark, and he is filled with inward grief!
He hides himself from the people because of the evil of that whereof he has been informed. Shall he keep her with dishonour or bury her in the earth? Certainly, evil is their decision!”
[al-Nahl 16:58-59]
One of the manifestations of this dislike of daughters is that in some hospitals, when they find out whether the foetus is male of female by doing an ultrasound scan, if it is male they tell the family, and if it is female they say nothing. This is a very serious matter from which stem a number of haraam things, including the following:
-It implies objecting to the decree of Allaah.
-It is a rejection of the gift which Allaah has given, instead of thanking Him for it. This is sufficient to earn Allaah’s anger and expose one to punishment.
-It involves humiliating the woman and putting her down, and putting unbearable pressure on her.
-It is an indication of foolishness, ignorance, stupidity and a lack of reason.
-It implies resemblance to the people of the Jaahiliyyah.
The Muslim should avoid such behaviour, and save himself from such destructive thinking. Submitting to the decree of Allaah is obligatory, and accepting it is one of the attributes of the believers.
Moreover, the virtue of girls is not unknown, for they are our mothers and sisters, and wives. They are one half of society which gives birth to the other half, so it is as if they are the entire society. See Tuhfat al-Mawlood fi Ahkaam al-Mawlood by Ibn al-Qayyim, p. 16.
Another indication of their virtue is the fact that Allaah calls their coming a gift (something which is bestowed), and mentions them before the males in the aayah (interpretation of the meaning):
“He bestows female (offspring) upon whom He wills, and bestows male (offspring) upon whom He wills” [al-Shooraa 42:49]
The Prophet (peace and blessings of Allaah be upon him) also explained their virtue and urged kind treatment of them, as he said: “Whoever is tested by means of these girls, and he treats them with kindness, they will be a protection for him from the Fire.” (Narrated by al-Bukhaari, 1418, with al-Fath; Muslim, 2729).