Strongyloides typically enters the human host as infective larvae through contaminated soil. Before maturing into adults, they undergo a visceral migratory phase characteristic of all strongyloids and some other nematodes such as ascarids. This typically involves a pulmonary migration phase in which the highly antigenic components of the nematode cuticle and ES products may cause temporary pulmonary irritation and edema, as the larvae pass through the lungs and into the intestine. In immunocompetent hosts, the adults produced larvae that pass in the feces to re-contaminate the soil. However, some autoinfection may occur in some patients, whereby larvae reach the infective penetration phase before leaving the host, and thus may penetrate directly, re-entering the patient. This is especially common among immunocompromised individuals, often leading to hyperinfection, in which high numbers of larvae migrate through their normal visceral passage en route to the intestine. This may result in large numbers of migrating larvae in the lungs, leading to severe pulmonary complications. This could result in the pneumonia, with larvae appearing in the sputum as you describe.
The presence of larvae of Strongyloides in sputum (or vomit) in hyperinfected hosts (e.g. immunocompromised by an intercurrent infection or drug-induce immunocompromise), is not uncommon. Explanation given above and the reference suggested deal properly with your question.
Thank you all for this very informative insight. It seems a problem that has not been addressed here and really would wish to follow it up and see how best we could advice the stakeholders to provide protective gadgets to resource challenged who are HIV exposed and who are also the same ones who toil in the infested farms!