One meaning of quarters is a lodging or where one is stationed. From that, one possible explanation for the phrase "give no quarter" is that no lodging will be provided to the enemy (as in no prisoners will be taken).
The "beat to quarters" phrase is based on the meaning of quarters as one's station. It is a naval term which is a call for the crew to go to battle stations.The modern US navy still uses the phrase "general quarters" (as does Star Trek). The British use the term "action stations" I think.
Thanks Junkseller! That's very interesting to know. I've been going nuts trying to figure it out. I'm not sure why I haven't researched it by now. Your name has caught my attention...what sort of business are you into?