He writes of the presence of 'carbonic acid gas'(he could be referring to carbon dioxide) in 'all abandoned forts in India' and describes its characteristics accurately, namely that it is denser than air and remains stagnant.
Most interestingly, he says the native remedy is a puja - where guests are fed and a fire is lit in the fortress, while explaining that the movement of the people and the rising air from the fire causes circulation with all the doors and windows open (or 'large openings'). In an occupied fortress, the normal movement of people prevents such accumulation of gas, he says. By his account about 6% of those who were lodged in these abandoned forts died within 5 years, which translate to 'thousands' of men.
This explanation seems to account for all the practices for a new home or some other 'special puja' to 'clear the bad air' (haven't you heard an elder say that?); it is also possible that the commotion and smoke could chase out insects and reptiles which may be in the building.
As to how the 'carbonic acid' got into the forts in the first place, it could be general decay from plants growing there, or, in my opinion, from the plaster or building material used - usually some form of mud or limestone(CaCO3) - which could degrade to give off the gas the author describes.
In India we carry out many practices in the name of tradition and culture - many of them may have had proper reason to carry out, but over time they have been exaggerated and their true purpose hidden.
Full relevant passage:
" The fortress is now entirely deserted, and the town, which the garrison supported, is occupied by only a small police-guard, stationed here to see that robbers do not take up their abode among the ruins. There is no fear of this. All old deserted fortresses in India become filled by a dense stream of carbonic acid gas, which is found so inimical to animal life that those who attempt to occupy them become ill, and, sooner or later, almost all die of the consequences. This gas, being specifically much heavier than common air, descends into the bottom of such unoccupied fortresses, and remains stagnant like water in old reservoirs. The current of pure air continually passes over, without being able to carry off the mass of stagnant air below; and the only way to render such places habitable is to make large openings in the walls on all sides, from the top to the bottom, so that the foul air may be driven out by the current of pure atmospheric air, which will then be continually rushing in. When these fortresses are thickly peopled, the continual motion within tends, I think, to mix up this gas with the air above; while the numerous fires lighted within, by rarefying that below, tend to draw down a regular supply of the atmospheric air from above for the benefit of the inhabitants. When natives enter upon the occupation of an old fortress of this kind, that has remained long unoccupied, they always make a solemn religions ceremony of it; and, having fed the priests, the troops, and a crowd of followers, all rush in at once with beat of drums, and as much noise as they can make. By this rush, and the fires that follow, the bad air is, perhaps, driven off, and never suffered to collect again while the fortress remains fully occupied. Whatever may be the cause, the fact is certain that these fortresses become deadly places of abode for small detachments of troops, or small parties of any kind. They all get ill, and few recover from the diseases they contract in them.
From the year 1817, when we first took possession of the Sāgar and Nerbudda Territories, almost all the detachments of troops we required to keep at a distance from the headquarters of their regiments were posted in these old deserted fortifications. Our collections of revenue were deposited in them; and, in some cases, they were converted into jails for the accommodation of our prisoners. Of the soldiers so lodged, I do not believe that one in four ever came out well; and, of those who came out ill, I do not believe that one in four survived five years. They were all abandoned one after the other; but it is painful to think how many hundreds, I may say thousands, of our brave soldiers were sacrificed before this resolution was taken. I have known the whole of the survivors of strong detachments that went in, in robust health, three months before, brought away mere skeletons, and in a hopeless and dying state. All were sent to their homes on medical certificate, but they almost all died there, or in the course of their journey. "
The memoir is available to read online(or you can save the html page to read offline).