After trade, Sheikh Zakariyya rahimahullah rates agriculture as the best occupation:
Charity. “Should a man plant a tree or busy himself with farming, and a person or a bird or an animal eats from it, then that shall be an act of charity for him. And if anything gets stolen then too it will be considered as charity.” (Muslim)
Compulsory. (Prophet Salih alaihis salaam) said, “O my people, worship Allah ; you have no deity other than Him. He has produced you from the earth and settled you in it…” (Quran 11:61)
Imam Abu Bakr Razi concludes from this verse that it is Wajib (compulsory) to fill the earth with crops, gardens and orchards. A tree or plant that one planted is a means of recurring reward after one’s demise. (Tarateeb)
Encouragement. “If the Final Hour comes while you have a palm-cutting in your hands and it is possible to plant it before the Hour comes, you should plant it.” (Al Adab al Mufrad, 1:479)
Independent. That farming is free of disgrace where you farm your own land. Otherwise, if it is done on rented farms or under the feudal system, then the Prophet sallallahu alaihi wa sallam has remarked that: “Verily into the houses in which these things (farming equipment) enter, dishonor and disgrace also enter.” (Bukhari)
Dawoodi mentioned that this refers to people who farm close to enemy borders and there is a fear of the enemy capturing them and their lands.