Only capital and sub-capital weapons with a range of long or extreme can fire at orbital targets for standard atmosphere worlds.
Per TW p235, medium capital range is up to 24 hexes. Per TW p236, each ground and atmospheric hex counts as six hexes for determining range, with interface hexes counting as 3 hexes for range, so with 4 atmospheric rows, that's 27 hexes total. Add 1 or more hexes depending upon how high the target is above the interface, then that's a minimum range of 28 required.
Orbit-to-ground fire is obviously directed towards a ground hex, so that means a ship's return fire is counted at a minimum of range 33. Orbit-to-surface shots also suffer a +2 hit penalty per atmosphere row, for a total +8 penalty for a standard atmosphere, to partially offset the -4 modifier they get for shooting a ground hex.
Altogether, what this means is that a ground battery on a standard atmosphere planet can shoot at a DropShip/WarShip that's up to 18 hexes away for long-range fire or 28 for extreme-range (4 atmospheric, 1 interface, plus 13 (long) or 23 (extreme) space), while the DropShip/WarShip can only return fire up to 13 hexes at long-range and 23 at extreme (1 ground, 4 atmospheric, 1 interface, plus 7 or 17 space).
Assuming both are Gun 4, then the DropShip/WarShip would be needing 12s at long-range (base 4 + 4 for range + 8 for atmosphere - 4 for ground hex target). That'd be 14s at extreme, and you can still shoot, because you're going to get artillery scatter. If a friendly can TAG the target, you get a -2 bonus, and each subsequent shot gets a -1 modifier if you have a friendly spotter with LOS (you want a role for LAMs, this is it in the SLDF - forward observers for ortillery). A friendly DropShip in the same Naval C3 net as the shooter can also provide a -2 modifier if it's flying or grounded close to the target ground hex (see SO p105 for the criteria it must meet).
For the ground-to-orbit battery shooting back, it would only need 8s at long-range (base 4 + 4 for range) and 10s at extreme. Direct fire weapons do suffer a +1 penalty per point of velocity change by the target in both the turn of shooting and the turn of arrival. So assuming the target ship is slow accelerating by 1 velocity each turn, then an energy weapon would suffer a +1 penalty, while a ballistic would suffer +2. The target ship would also have the option of evading per normal rules. Missiles are messier, they don't suffer a hit penalty for velocity changes, but they take 1d6 turns to get to the target and auto miss if the target had moved out of range. Ballistics can also auto miss if the target moved out of range during the turn the fire was due to arrive.
The rationale for ground batteries not suffering a +2 hit penalty per atmospheric hex is that unlike WarShips they have sensors optimized for the local atmospheric conditions. It's not clear whether ground DropShips conducting surface-to-orbit fire enjoy the same benefit, so a question will be asked.