The most important thing to keep in mind is that Lawrence was very determined to stay in India
When the 52nd left India he moved to the 36th (for two weeks) and then to the 33rd and when that left he moved to the 56th. What his motivation was is not clear, possibly it is because he was born in India or that he had a wife and children in India or a combination of both.
In summary his military career consists of a steady rise to the rank of Major (Brevet) over a period of 25 years and although some of it was spent in Maritius, the majority was in India and the impression one gets is that he was more an administration man than a fighting man.
What we know of his military career is this:
1796 - Ensign, 52nd Regiment of Foot. 1 August 1796 in Tanjore 
1796 - Declines Lieutentant, 7th Regiment of Foot vice Stuart 10 October 1796 
1797 - Lieutenant, 52nd Regiment of Foot. 1 January 1797 
1797 - Lieutenant, 36th Regiment, seconded on 1 November 1797 (2 weeks)
1797 - Lieutenant, 33rd Regiment of Foot 15 November 1797 in Madras 
1806 - Captain, 33rd Regiment of Foot. 23 December 1806
1811 - Joined 56th Regiment of Foot. 26 August 1811 
1819 - Brevet Major, 56th Regiment of Foot 12th August 1819
1822 - Retired 10 January 1822. 
It seems that he did not buy his Ensign (there is no record in the purchases records at the PRO and the entry in the London Gazette does not mention purchase). It also seems that he was not unique in exchanging Regiments to stay in India as others did likewise, whether this was to remain in India due to family ties or in the hope of retaining spoils is not clear.
 Source: London Gazette Issue 14004 published on the 25 April 1797. "Lawrence O'Hara, Gent to be Ensign vice Macdonald promoted in the 72nd Foot."
 Source: PRO WO25/225 p936.
 Source: London Gazette Issue 14078 published on the 30 December 1797.
 Source: London Gazette Issue 15108 published on the 16 February 1799.
"Lieutenant Lawrence O'Hara, from the 52nd Foot, vice Fennell, who exchanges".
 Source: London Gazette Issue 16581 published on the 7 March 1812. "Captain L O'Hara from the 33d Foot, to be Captain of a Company, vice Colclough, who exchanges".
 Source: London Gazette Issue 17505 published on the 12 August 1819.
 Source: London Gazette Issue 17783 published on the 19 January 1822.
"56th Regiment of Foot, Lieutenant Redmond Brough to be Captain, by purchase, vice O'Hara, who retires. Dated 10th January 1822".
 Source: Caledonian Mercury (Edinburgh, Scotland), Monday, October 12, 1807; Issue 13383.
"Lieutenant Lawrence O'Hara to be captain of a company vice Know, deceased"