Can I play Grim Apothecary to base and use its effect as a reaction to an opponent attacking a battlefield that I control? Or does it need to be played at that contested battlefield?
No. You cannot play Grim Apothecary to your base as a reaction to an opponent attacking. To use its Ambush timing, you must play it to a battlefield where you control units.
Why: Ambush grants Reaction timing only conditionally — specifically when playing the unit to a battlefield where you control units (Rule 822.1.b, FAQ #10089). Playing it to your base doesn't meet that condition, so it's a normal Main Phase play only.
What you can do: If the opponent attacks a battlefield where you still have units, you can use Ambush to play Grim Apothecary to that battlefield as a Reaction during the Showdown. Once it enters, its "When you play me" trigger goes on the chain, and you can return a friendly unit (even itself, per FAQ #9746) to your hand — which could save a unit from dying in combat. However, the battlefield must still have at least one of your units there when you finish playing it, or Ambush's permission no longer applies (Rule 822.3).