From an Alpine substrate language. The original sense is that of a pasture, the use for a building is secondary; hence no relation with Arabic مَلْجَأ (maljaʔ, “refuge”).
Practica hablar y memorizar " malga " y muchas otras palabras y oraciones en italiano .