Whether it be AC or DC, for current to flow through your body you need two things:
- voltage to ‘push’ it (potential difference)
- a complete path for it to flow
First, DC.
A battery just sitting there without a connection is insulated. Touch one of its terminals and that terminal becomes the same voltage as you. Once that happens, no current flows*.
*If you and/or the battery have some static charge, some current will flow until the charge is equalized. That is, your body has capacitance to ground, even if you aren’t grounded yourself. We'll come back to this.
Now touch the second battery terminal at the same time. A path is formed and current flows. That’s why you get a bit of a shock when you touch a 9V battery to your tongue, but only if you touch both terminals.
Now, let’s make things interesting. Consider a grounded, high-voltage battery pile: more than 100V, say, like you might encounter with a home solar setup. If you touch that, and are grounded, a complete circuit is formed through you and back to the battery, and you will get a shock, possibly a lethal one.
(There is some debate as to which is more 'lethal': AC or DC. More about that here: https://www.electronicsforu.com/resources/ac-dc-current-body-dangerous Nevertheless, non-touch-safe DC deserves your caution and respect, same as AC.)
If you are insulated, your body will assume the same potential as the battery: your body capacitance will be charged to the same voltage as the battery, after which no current will flow.
Now let's talk about AC.
An AC power line has a reference to earth ground, in multiple places: at the utility head end, from time to time on the distribution towers and poles, and near where it enters your home. If you touch a power line, and you are also grounded, again, current flows from the line, through you, then to ground (which, by definition, has almost no resistance.)
Again, if you are insulated from ground, perhaps by your shoes or, say, by dangling in mid-air from a helicopter, (mostly) no current flows. We'll talk about that weasel-word 'mostly' below.
More here: Professor said no current flows to ground
Your insulated body nevertheless still has capacitance to adjacent ground, which provides an AC path. That’s why you can still get a shock from a live wire by touching just one terminal, even if you're not touching ground or another live wire (and, also why that helicopter in the video above has a huge arc to the powerline while they're depositing the high-wire guy on it.) The AC will alternately charge and discharge your body capacitance, and if the voltage is high enough, the resulting current can be fatal. In comparison, DC will only charge you up just once, to the DC potential.
Body capacitance is also why you get a shock from static electricity: your body capacitance stores or releases charge if you come into contact with something else at a different relative-to-ground potential. This is why ground straps are needed when working on sensitive electronics: to bleed off static charge, equalizing your body static voltage to the gear you're working on.
What about ground?
Again, by definition, earth ground has practically no resistance by itself. The Earth is such a large object with a lot of conductive matter in it, especially iron. Thus, it has a very, very low internal resistance. Of course, earth resistance varies locally depending on the earthen material, but in aggregate it's low enough to not matter.
In fact, Earth ground is so low-resistance that early telegraph and even some power systems relied solely on ground as a return, using only one wire to send a signal.
With grounding systems, any local resistance to Earth is largely due to the grounding connection itself. Example: a grounding rod installed at a residence must be 25 ohms or less to be code-compliant; usually they're a few ohms. Earth grounds used by larger systems like utilities will be much, much lower than that. So this is why we assume that 'ground' has no resistance.