He was handcuffed to the roof for more than a few hours.
Day one: we are introduced to him, handcuffed on the roof. The others run, leaving him. They return to camp.
Night: Lori and Rick get it on while there is a thunderstorm, Shane sits guard on the trailer, eying the tent.
Day two: They go back to rescue Merle.
This is as far as we know.
Merle was not a sane guy in the first place, as is obvious. And, he was under unique circumstances: the combination of the heat, lack of food and water (even if for a few hours), direct sunlight, a thunderstorm, and the biggie in dead people who only want to eat him. This would, of course, eventually cause massive panic. In his mind, he had no choice.
And, he could have been picked off the roof top by the helicopter.