Since I am not clear what insect or worm you are dealing with, it would be out my expertise to give a solution.
Healthy Fig Trees that are properly cared for are less susceptible to disease and insect damage.
I would contact local agencies that deal with agriculture in your area.
They can likely give you information that would help deal with the issue that is effecting your exact geographic location.
Here are some links that I found with some information on insects harming Fig crops.
http://www.ipm.ucdavis.edu/PMG/PESTNOTES/pn74158.html
http://ucanr.edu/datastoreFiles/391-299.pdf