My uncle was an old Indian army man. He explained that the place was grim and used to send troops in the transit camp round the bend. There was also a mental hospital there.
Similar situation in Cairo. Abbassia No 2 was a transit camp whilst Abbassia No 1 was a mental hospital so Abbassia became inter-changeable with ma'hoon (mad)
Extract from, 'Old Soldier Sahib', by Frank Richards DCM MM (The Naval & Military Press):
"......when we left by train for Deolalie, which at this time was a depot for all troops arriving in the country and also for all time-expired me who were leaving it. the trooping season began in October and finished in March, so that time-expired men sent to Deolalie from their different units might have to wait for months before a troop ship fetched them home. Moreover, if a man completed his seven years service with the Colours on the 30th September he caught the last boat of that trooping season; but a man who completed his seven years on the 1st October would have to serve another year with his battalion and catch the first boat home the following trooping season. The time-expired men at Deolalie had no arms or equipment; they showed kit now and again and occasionally went on a route-narch but time hung heavily on their hands and in some cases men who had been exemplary soldiers got into serious trouble and were awarded terms of imprisonment before they were sent home. Others contracted venereal and had to go to hospital. The well known saying among soldiers when speaking of a man who does queer things, "Oh, he's got the Doo-lally tap," originated, I think, in the peculiar way men behaved owing to the boredom of that camp."
According to http://www.far-eastern-heroes.org.uk/alberts_war/html/doolally_tap.htm "tap" is a hindustani word meaning "fever." Puttees Senior was sent to India in 1944 and in the course of his stay was tasked with taking somebody to the hospital at Deolali. (The unfortunate had developed a phobia of rank badges and would lay into anybody from LCpl upwards. The old fellah was a Cpl, but apparently was the only person who was immune to the violent outbursts. I believe the chap never made it home, committing suicide as a result of repeated visits by doctors wearing officer rank).
The phrases I've heard from those that have served in India are "He's got Doolally Tap" (often used by Puttees Super Senior, who was stationed in India between the wars) or "He's gone Doolally" (as in, gone to the hospital) or, as Vimeiro said, someone could be "sent Doolally." The other phrases mentioned in this thread are presumably derivations by people who have latched onto Doolally inferring mad, rather than it's true origin.