Why is the word Gestapo feminine? Almost all other (non-abbreviated) loanwords I can think of ending in -o have been absorbed as masculine. Is it because it is associated with policía?
In all the Romance languages, gestapo is feminine despite its ending. It is most likely that whichever language first imported it (probably either French or Italian) figured that because gestapo stands in for Geheime Staatspolizei (policía estatal secreta), the appropriate use would be to make it feminine as with the analogous words la police (FR), la polizia (IT) especially considering that polizei is, coincidentally, also feminine in German. Spanish and others, in turn, maintained that usage, although it's possible for separately and independently maintaining the feminine nature of policía/polizei.
Also, even though it ends in -o which normally pushes words to be masculine, I find that acronyms and abbreviations for organizations tend to maintain the connection to the base noun's gender moreso than more common nouns.
Is it because it is associated with policía?
The answer is yes according to the DPD (Diccionario Panhispánico de Dudas):
1. Se llama sigla tanto a la palabra formada por las iniciales de los términos que integran una denominación compleja, como a cada una de esas letras iniciales. Las siglas se utilizan para referirse de forma abreviada a organismos, instituciones, empresas, objetos, sistemas, asociaciones, etc.
4. Género. Las siglas adoptan el género de la palabra que constituye el núcleo de la expresión abreviada, que normalmente ocupa el primer lugar en la denominación: el FMI, por el «Fondo» Monetario Internacional; la OEA, por la «Organización» de Estados Americanos; la Unesco, por la United Nations Educational, Scientific and Cultural «Organization» (‘Organización de Naciones Unidas para la Educación, la Ciencia y la Cultura’)
Let me try to translate the quoted text:
1.We apply the name sigla both to the word formed by the initials of the terms that combine in a complex denomination and to each of the initial letters. Siglas are used to refer in an abbreviated form to organizations, institutions, companies, objects, systems, associations, etc
4.Gender. Siglas adopt the gender of the word that represents the nucleus of the abbreviated expression, that which usually occupies the first place in the term: el FMI (Fondo Monetario Internacional; la OEA (Organización de Estados Americanos), la UNESCO (United Nations Educational, Scientific and Cultural Organization), ...
So, it seems that Gestapo (Geheime Staatspolizei) follows this rule, its nucleus being polizei.
Thinking about this question, I've realized that there is a rare exception to this rule: KGB (in Spanish: Comité para la Seguridad del Estado). I've read both el KGB and la KGB. We can use el taking Comité as its nucleus but we also may use la because KGB is a secret police agency, like their counterpart la CIA. KGB was an agency and a sort of police like the Gestapo so we use la as determiner as well.
The term "Gestapo" is a contraction of "Geheime Staatspolizei", and the last word "Polizei", which is feminine in German, determines the grammatical gender.
Cf also the very beginning of the Spanish Wikipedia entry for Gestapo:
La Gestapo (contracción de Geheime Staatspolizei: 'Policía Secreta del Estado') fue la policía secreta oficial de la Alemania nazi (...)
Until the year 1936 the term "Gestapa" was also in use, a contraction of "Geheimes Staatspolizeiamt", the last word being neuter in German.
The answer for this is simple - but you may not understand it fully if your native language has no specified gender for every word, such as it is in portuguese. The simple reason is that "La Gestapo" refers to "La Policia Gestapo", and "Policia" (police) is a feminine word.
There's really no specific rule for which words are masculine and which are feminine and that's why this issue may confuse those whose native language hasn't got this aspect.