It's my understanding that in the Middle Ages landed gentry were treated as military leaders by default, today Prince Harry is in principle a normal officer, how did the one situation transition to the other?
Yes, he would have been paid a salary, but it was a low salary relative to an aristocrat's lifestyle. Lord Grantham would have been a normal officer. The officer corps of the late 19th century was significantly professionalized, but was still for the most part limited to the upper classes, and most land-owning, to say the least of noble families, had a strong tradition / expectation of military service, and sons of gentry were accordingly very common among officers.
It isn't really helpful to compare the above to the contemporary tradition of Royal Family military service. For the 20 year rule I won't comment upon current service but Prince Charles, Prince Andrew and Prince Edward all spent meaningful numbers of years as (in a sense) ordinary officers, at their merit ranks and pay, with ordinary duties. Obviously this was accompanied by abnormal levels of time off for Royal duties and plenty of added security and protocol and limitations.