Ruling on learning worldly sciences and the manufacture of military hardware
Question

                What is the ruling on learning worldly sciences and the manufacture of military hardware? Is this obligatory on the Muslims? Will the Muslim who learns them be rewarded?
Praise be to Allah. 
          With regard to science (apart from the sciences of sharee’ah), i.e., 
          extracting metals and minerals, agricultural science and all beneficial 
          sciences, it may be obligatory to learn of them that which the Muslims 
          need, and it is fard kifaayah. The ruler should enjoin that which the 
          Muslims need, and help the specialists in that field to achieve that, 
          i.e., by helping them to do that which will benefit the Muslims and 
          strengthen them against their enemies. A person’s deeds will be rewarded 
          according to his intentions. It will be counted as an act of worship 
          to Allaah if his intention is correct and sincere. If he does it without 
          any intention it will be counted among permissible deed, I mean permissible 
          kinds of manufacturing, extracting minerals, agriculture, etc… 
 
          All of these are essential matters, but if they are done with the proper 
          intention they may also be acts of worship. If there is no such intention 
          then they may be permissible things. They may be fard kifaayah in some 
          cases, if necessity calls for that. The ruler has to demand that of 
          whoever is qualified to do it, because they are essential matters and 
          there is a need for that. They differ according to intention and according 
          to need.