The origin of ‘quarter’ with the meaning of ‘living quarter’ comes from the French verb écarter, which means ‘to separate’ or ‘to set apart’.
In the military context ‘living quarters’ are those areas of a military compound/base, which are designated for accommodation. This could be a mess (one for SNCOs and one for Officers) or married quarters for married personnel, with the distinction of Officers and Other Ranks. Thus the accommodation is ‘set aside’ or ‘separated’.
By the way, the camera photo is of Mr Marquesate in a transit accommodation, which are not known to be luxurious.