Military starbases, with the appropriate modules, enhance the weapons and defense of your ships that are in the influence area of the starbase. It's these enhanced ships that you can use to defend your planets.
You can add weapons and defense to Military starbases (or any other kind of starbases) but these only attack and defend when the starbase itself is attacked.
I don't use military starbases myself very often but in general the modules enabled by the Starbase Fortification branch of the tech tree only work when the starbase itself is attacked and the modules enabled by the Starbase Defenses branch of the tech tree enhance the weapons and defenses of ships in the influence are of the starbase.
Between the two kinds there are over 60 types of these modules so they're way too many to list here but the Battle Stations, Subspace Blaster, Star javelin, Ship Pounder, Ray Shielding, Missile Defender and Combat Armor series of modules all affect the starbase itself. The Beam Multiplier, Omega Cannon and Missile Bloom series among others all affect ships within the influence area of the starbase.