A fixed wing aircraft is able to glide in case of an engine failure and potentially land safely.
What would happen if a helicopter engine fails at high altitude?
Is it possibly to land it safely?
Yes. See the Wikipedia's article on autorotation!, which mentions a real-world example of the case you are describing:
The longest autorotation in history was performed by Jean Boulet in 1972 when he reached a record altitude of 12,440 m (40,814 ft) in an Aérospatiale Lama. Because of a −63 °C (−81.4 °F) temperature at that altitude, as soon as he reduced power the engine flamed out and could not be restarted. By using autorotation he was able to land the aircraft safely.
The biggest concern here is the disk loading of the helicopter's rotor - the greater the disk loading (the mass of the aircraft related to the rotor's area) the worse the autorotation capabilities. See this Google Books link for an in-depth discussion of the autorotation capabilities of different aircraft based on their characteristics.
The weight of the very rotor also plays a significant role here - the heavier the rotor, the more kinetic energy it stores, and the greater the probability of a successful entry into the autorotation state. See the Osprey's design, for example - it has light propellers on each wing which are practically unable to autorotate because of their small mass.
As you can see, the aforementioned helicopter - Aérospatiale Lama - is a light aircraft which is geared towards high altitudes - it has three propeller blades, which translates to low disk loading, and sufficiently heavy blades to allow easy entry and execution of the autorotation stage.
When a helicopters engine fails, it would start falling until Auto rotation kicks in.
Whether this happens and the pilot shuts off the engine or in the case of actual engine failure, once the engine drops below a certain number of revolutions per minute, relative to the rotor RPM rate, a special clutch mechanism, called a freewheeling unit, disengages the engine from the main rotor automatically. This allows the main rotor to spin without resistance from the engine.