In 1920s USA slang, a 'heater' was a gun and this was sometimes shortened to just 'heat'. As a result, 'the heat' came to mean a gun-battle, the police and related ideas. Hence, there were phrases such as 'the heat's on' meaning trouble's brewing/the police are after me etc. Accordingly, at the end of any such persecution, the heat was said to be 'off', giving rise to your phrase: "take the heat off."