An elevation dataset will have two independent datums: a horizontal datum and a vertical datum. The horizontal datum is a property of the CRS, it maps an (x,y) value to a location on the earth. The vertical datum is a property of the data, like a specific sea level.
For example, the SRTM dataset has a WGS84 horizontal datum because it uses the EPSG:4326 projection, and it has a EGM96 vertical datum. In general, changing the CRS (which may change the horizontal datum) won't change the vertical datum, and vice versa.
There are some practical factors that can make this more complicated:
- Transforming data to a new CRS involves interpolation, which may alter the elevation values in the dataset even though the vertical datum is unchanged.
- A geo raster file may not include the vertical datum as metadata, you might have to go back to the source documentation to find it.
- Some elevation datasets don't specify a vertical datum if the difference between different sea-level datums is less than the accuracy of the data.
See this answer for using gdalwarp to convert both datasets to a common CRS and vertical datum. You'll need to know the CRS codes for both datasets, and the vertical datums for both. And you'll need to download the grid shift files for each vertical datum.