Frederic loses faith in the war in various places rather than as a single revelation.
Working on the ambulance in contact with the wounded and dying sharpens his awareness of the limited effects of the combat. War is nothing sacred, despite what the leaders say; soldiers were treated like cattle.
The things that were glorious had no glory and the sacrifices were like the stock yards at Chicago if nothing was done with the meat except to bury it.
Getting wounded himself and being away from the fighting gives him time to reflect, which further undermines his faith.
A marker that faith is involved is Frederic's meeting with the priest, who had "always known" what he is learning.
Deciding to desert is a clear marker that his faith was already gone. Reflection on the cost of war for all involved, not just the combatants, confirms this attitude.
People bring so much courage to this world the world has to kill them to break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places.