Space combat, by the nature of the vast distances it takes place at, involves massively powerful weapons, with energy yields that would cause catastrophic damage if used inside of a planet’s atmosphere. While such weapons can be used against terrestrial targets in certain circumstances, it is regarded as gross overkill, and highly discouraged.
Capital ship weapons are generally designed to fire in two different modes, one for anti-ship combat, where they fire full-powered shots, and one for tactical bombardment of planetside targets. This is easy for energy-based weapons, which can simply control the amount of power funneled into the weapon, and explosive weaponry, which can be designed with adjustable warheads. Even chemically propelled weapons can fire rounds with different propellent charge sizes to allow for radically different velocities.
Tactical bombardments are a powerful tool of any navy, and are something that military leaders make sure they always have at their disposal. The ability to allow capital ships to act as normal artillery is indispensable.