Hi!
This question came up a few months ago. You can find a couple of relevant SUBSIM threads
here and
here.
The upshot seemed to be that U-boats had the ability to measure water density and pressure, but were not equipped with a bathythermograph
per se. The Germans understood the usefulness of thermal layers in evading active sonar and recommended their captains sample the water regularly to look for thermal layers, but the extent to which U-boat commanders could or did sample water density and temperature while evading an escort was not clear. The developers apparently stated their intent to model the effects of thermal layers on sonar, but I'm not sure whether this was implemented or not.
Pablo