Love etymology! OK - let's start with the Roman Legions. The soldiers on march always set up their camps in exactly the same way - divided into four sections with the officers and certain other items in the middle - hence quarters! A drawing illustrates this layout. read more
It is this meaning, denoting a part of a settlement where a certain group lived, that came to inform the word quartermaster (originally, a person who oversaw the stocking of a ship's hold) with the location-based aspects in addition to its rations-based aspects. From there the sense of quarters as military housing comes. read more
The military portion is the military quarters, just like the French part of town is the French Quarter, as in New Orleans. A smaller and smaller area will suffice as one's personal quarters, until quarters comes to mean lodging in general, though with a military connotation. read more