This happens because of difference of pressures at sea level and in the mountains. In the mountains pressure has a lower value, so the water used to cook has a lower boiling point and it needs more time to "soften spaghetti up".
Water boils when the vapor pressure of the water equals the atmospheric pressure that's pressing down on it. Water boils at a lower temperature (more easily) at higher elevations (like on mountains), because:
- Atmospheric pressure is lower at higher elevation
- Easier for vapor pressure to equal this lower atmospheric pressure
Since the water boils at a lower temperature, it takes longer for the pasta to cook.