Of course, fossil fuels are a feedstock in the manufacture of many useful substances. But usually, what they contribute to those substances is carbon (and specifically, carbon in a form that’s easy and economical to work with). But the key ingredient in fertilizers is nitrogen compounds, and sometimes various other elements like phosphorus. But not carbon: Plants get the carbon they need from the atmosphere, not from fertilizer.
And sure, making nitrogen compounds is energy-intensive, and right now, that energy mostly comes from fossil fuels. But that’s the same story as all the rest of our considerable energy usage: It’s mostly fossil fuels because they’re cheap, but it could be any other source of energy.
So just what are fossil fuels used for, in the manufacture of fertilizers, and how easy would they be to replace in that role?
It appears that the main fossil-fuel based synthetic fertilizers are ammonia-based, using atmospheric nitrogen but requiring hydrogen from natural gas (mostly methane, CH4). But that’s a lot of fertilizer.
Undoubtedly, there are a lot of potential alternatives to natural gas to source hydrogen, but if they were economically competitive they’d be in use instead of natural gas.
As of 2018, the Haber process produced 230 million tonnes of anhydrous ammonia per year.[72] The ammonia is used mainly as a nitrogen fertilizer as ammonia itself, in the form of ammonium nitrate, and as urea. The Haber process consumes 3–5% of the world’s natural gas production (around 1–2% of the world’s energy supply).
You are correct that “green hydrogen” is more expensive to produce.
As of 2024, low-emission hydrogen, including both blue and green hydrogen, accounted for less than 1% of global hydrogen production, with green hydrogen only making up around 12% of all low-emission hydrogen production.[5][6] Green hydrogen is more costly to produce compared to all other methods of hydrogen production, however, with new technological developments as well as the increasing cost of natural gas, the cost gap is expected to narrow by 2030.
As far as I know, the primary elements in fertilisers are nitrogen, phosphorus and potassium.
Nitrogen is largely extracted from the atmosphere by the Haber process, which requires energy: but that doesn’t have to involve carbon.
Then as you say, the other two elements are probably limited by available sources. The elements themselves are not especially rare, but perhaps not readily available in useful form. In fact I have seen suggestions that phosphorus might be a limiting factor?
What’s a limiting factor depends on your particular soils. Some soils are naturally higher in phosphorus than others. Some have had so much phosphorus piled on to them in fertilizer over the years that the runoff has become a serious pollution problem.