When a lawn mower backfires it's usually caused by the fuel in the lawn mowers engine not igniting properly.
The cause of the backfire on the lawn mower and the fuel not igniting properly could be a bad or worn out spark plug or the spark plug gap is not set correctly.
That can then lead to the fuel not igniting properly when then causes a backfire of the engine.
If the gap is set correctly on the lawn mowers spark plug or the spark plug is good then it could also be caused by the air/fuel mixture being a bit too lean and sometimes the carburetor may need to be adjusted.
Or the engine could be getting too much fuel into the carburetor which then builds up inside the engines intake and then it backfires as a result of too much fuel.
That can be caused by the needle sticking open which allows fuel into the carburetor bowl if your lawn mower has a carburetor with a fuel bowl.