Building codes actually tend to be Local (the city if you are in the city, or the County if you are not within the city limits.
Churches most certainly are required to build according to the local code.
They are usually required to build according to the local Commercial Code (like a store or theater rather than a private house).
They are required to get both a Site Development permit for changes to the land (like adding parking for the new building) and a Building Permit for any actual structures (including things like a flagpole).
Where Churches tend to get special treatment in the code is that church uses are allowed in any zoning district.