Praise be to Allah.
The knowledge mentioned here is the knowledge of sharee’ah which is derived from the Qur’aan and Sunnah. This is the legacy of the Prophets, for the Prophets did not leave behind dirhams and dinars (money), rather they only left behind knowledge. Whoever learns it gains a great deal. When the texts commend knowledge, what is meant is knowledge of the Qur’aan, Sunnah and sharee’ah. This also includes knowledge of nahw (grammar), i.e., the Arabic language, because it is the language of the Qur’aan: knowledge of how inheritances are to be shared out (faraa’id); acts of worship (‘ibaadaat); interactions with others (mu’aamalaat); punishments prescribed in sharee’ah (hudood); the shar’i literature and Arabic literature, for it is the biography of the close friends (awliya’) of Allaah and His righteous slaves. Similarly it is important to know the means to this knowledge, such as Usool al-Fiqh, tawheed, ‘Aqeedah, the basic principles of Islam, etc. With regard to other, worldly sciences which the Muslims need to know, there is no doubt that they come under the heading of fard kifaayah (communal obligation, i.e., if some of the community does it, the rest are absolved of the obligation); those who are able to learn them are obliged to do so, thus fulfilling the obligation of fard kifaayah, because the people are in need of that, so long as that does not prevent them from learning the things that they are obliged to know. Undoubtedly there is benefit in sciences such as biology, chemistry, etc. Many of the scholars were of the view that it is obligatory to learn necessary crafts and industries, and there should be enough people who have these skills, such as blacksmiths, tailors, barbers, etc.
Shaykh ‘Abd-Allaah ibn Jibreen
And the sciences which Muslims are in need of, such as military skills, are even more essential and more obligatory. And Allaah knows best.