Sodium aluminoborate glasses are found to exhibit favorable mechanical properties, especially high crack resistance, due to their relatively low resistance to network compaction during sharp-contact loading. We here reveal the origin of the high crack resistance by investigating changes in structure and mechanical properties in compositions ranging from peralkaline to peraluminous and by varying the pressure history through an isostatic N2-mediated pressure treatment at elevated temperature. This approach allows us to study the composition dependence of the ease of the glassy network compaction and the accompanying changes in structure and properties, which shed light on the processes occurring during indentation. Through solid state NMR measurements, we show that the network densification involves an increase in the average coordination number of both boron and aluminum and a shortening of the sodium-oxygen bond length. These changes in the short-range order of the glassy networks manifest themselves as an increase in, e.g., density and indentation hardness. We also demonstrate that the glasses most prone to network compaction exhibit the highest damage resistance, but surprisingly the crack resistance scales better with the relative density increase achieved by the hot compression treatment rather than with the extent of densification induced by indentation. This suggests that tuning the network structure may lead to the development of more damage resistant glasses, thus addressing the main drawback of this class of materials.