why is the use of fossil fuels not a long term solution to the worlds energy needs.

2 answers

Well, we will run out of fossil fuel first of all. It is by definition not "long term" because we are using it up faster than plants are turning into coal and oil and even gas.
However there are more immediate obvious problems such as air pollution and land pollution and water pollution. Medium term you have the warming effect of increasing concentrations of CO2 and Methane(natural gas) in the atmosphere leading to reduced heat radiation from earth and therefore rising temperature.
For one, there is not an infinite supply. Secondly, they contribute to increased CO2 in the atmosphere and other pollution.