In order to determine your crafts relative direction to the the magnetic north it uses a compass which measures the earth magnetic field. But this require that the compass can do it's measure without influence of other magnetic fields coming from nearby ferromagnetic objects.
The compass in your craft measure the sum of several magnetic fields in reality ... this as several internal components in your craft is ferromagnetic, and this sum will not be a good indicator of the earth magnetic field ... the compass will not point to north.
In order to "wash away" other interfering fields coming from internal components in your craft a compass calibration is performed. Plain & simple ... a compass calibration measure the craft's own magnetic field so the flight controller can deduct that from the total sum of magnetic fields ... leaving it with clean information about the earth magnetic field.
So a compass calibration is generally only needed if you have altered the craft's own magnetic field ... added or taken off any equipment from the craft itself.
A compass error is usually triggered when the measured magnetic field field strength sum falls out side a pre-programmed acceptable interval ... like if you place the craft near something ferromagnetic, like the rebar's just below the concrete surface where you place the craft ... or you hold your craft with the hand where you wear a big steel watch ... or place your craft just above a nail on a wooden deck ...
If you get a prompt to calibrate the compass ... always question that. Power off your craft & move to another spot instead, & power on & see if the prompt comes back ... if it's still there it can be motivated to do the calibration.
Then add below to your take-off procedure ...
Before take-off ALWAYS ... add in one very easy check to avoid a really scary event coming from accidentally launching from a magnetic disturbed place with following flyaway at height in an uncontrollable circular or straight flight path.
After powering on your drone, connected to your RC/app & placed it in the take-off spot ... but before lift-off, ALWAYS check that the drone icon on the map in your app is pointing equal in relation to other objects in the map as the drone does in reality ... if not, abort launch attempt, POWER DOWN & move away, power up again and repeat.