The orientation drift from gyro data is unavoidable because of integration. However it is easily mitigated by sensor fusion with accelerometer and magnetometer. So, the combined stability of the system depends on the drifts of accelerometer and magnetometer only, which are mostly thermal in nature.
For this reason many modern IMUs include temperature sensor as well. So, consult the datasheets and see if accelerometer and magnetometer thermal drifts (both sensitivity and offset) are within your requirements. If you have a choice then select IMU with built-in thermal sensor. Implement offset calibration routines in your software. Finally do the experiments over wide temperature range and capture sensor drift data (which also can be slightly different from chip to chip due to manufacturing variations). Then incorporate this data into your code as dynamic offset based on temperature sensor.
Note that all of the above is only necessary if your requirements are extremely high. For most consumer devices a simple 9D sensor fusion is sufficient.