The Master of both Worlds şallAllāhu álayhi wa sallam states:
The acquisition of ilm is obligatory upon every man [and woman].
The gaining of ilm is obligatory upon all, the ilm referred to in the Hadith above is the knowledge of Sharia rules pertaining to the daily activities of both men and women.
The shari’ rulings in regards to salah and fasting are obligatory upon all, [but] the rulings in regards to menstruation are obligatory only upon women. One who is travelling to pilgrimage, the shari’ issues in respect to a successful pilgrimage are fard ul ayn [only upon the individual travelling for pilgrimage], however studying to become a learned scholar [aalim] is classified as fard ul kifayah, that if one individual in that town fulfils this condition, the condition will be fulfilled in favour of all. [Mira’at Ul-Manajīh]
——-
glossary:
ilm: knowledge
fard ul ayn: in Islamic law, refers to legal obligations that must be performed by each individual Muslim, including prayer, charity, fasting, and pilgrimage
fard ul kifayah: a legal obligation that must be discharged by the Muslim community as a whole, such as military struggle; if enough members in the Muslim community discharge the obligation, the remaining Muslims are freed from the responsibility before God. However, if a communal obligation is not sufficiently discharged, then every individual Muslim must act to address the deficiency.