Yagna produces rain(by satisfying gods) which is a necessity for life on earth, so yagna helps ecosystem/environment to sustain itself.
You should look at context, Sri Krishna is showing importance of doing vedic karma/karma-yoga to arjuna(and the whole world).
In BG 3.12(context for BG 3.14)Bhagwan Sri Krishna is talking about benefits/good-consequences of doing Yagna/Worshipping gods by sacrifices(aka Ishta). Bhagwan also points out that the one who does not perform Sacrifices is thief.
इष्टान्भोगान्हिवोदेवा दास्यन्ते यज्ञ भाविता: ॥
तैर्दत्तान प्रदायेभ्यो यो भुङ्तेस्तेन एव च ॥३.१२॥
In charge of the various necessities of life, the demigods(I prefer gods), being satisfied by the performance of yajna [sacrifice], will supply all necessities to you. But he who enjoys such gifts without offering them to the demigods in return is certainly a thief. BG 3.12
Since Rain is a necessity for life on earth, Gods shower rains as a result of Yagna-karma done by human beings, that's how yagna produces anna or food.(Yagna -> Rain -> Food).
अन्नाद्भवन्ति भुतानि पर्जन्याद्न्नसम्भव:।
यज्ञाद्भवतिपर्जन्यो यज्ञ: कर्मसमुद्भव ॥३.१४॥
All living bodies subsist on food grains, which are produced from rains. Rains are produced by performance of yajna [sacrifice], and yajna is born of prescribed duties. BG 3.14
Further Sri Krishna says that Yagna is born out of karma and karma from Bramhan.
Point to be noted:
Yagna means Sacrifice and there are a lot of categories of Yagna. Out of which Japa yagna is the best one. So even Japa yagna helps in sustainment of environment, it is not necessary to do fire rituals.
On a side note I would like add some scientific speculation.
Its highly unlikely that the Ghee burnt in Agnihotra and Yagnas, would burn(remember combustion is oxidation reaction consumes oxygen instead of releasing oxygen) and create oxygen to purify atmoshpere.