The floor and soil don't have an overly low specific resistance, but it provides a lot of area for the current to flow through (as do your feet compared to the contact area of a wire). Combine this with the fact that wall voltages are high and not much current needs to flow to do some damage to your body.
So it follows that if the resistance between the transformer windings is much higher than the soil and earth, then it should be obvious how the isolation transformer protects you. It disconnects the ground potential on the primary from the 0V on the secondary and lets the 0V float so you must touch both secondary wires to get shocked. If you just touch one secondary wire, the potential at that wire becomes equal to your potential and the potential difference on the other terminal floats higher or lower maintaining the same voltage between secondary terminals.
You seem to be questioning how you could possibly be connected to the soil or the ground rod outside when you are several floors up in your building. Let's do some math.
For example, the resistance of rubber is on the order of \$10^{13}\$ Ohms-meters. This should be quite a bit higher than most materials. The resistance of copper is on the order of \$10^{-8}\$ Ohm-meters. So that's a difference of \$10^{11}\$ times. We would need an area of rubber \$10^{11}\$ larger than the area of the copper for it to be equally conductive.
The area for 16AWG wire running to your toaster is \$1.31mm^2\$. The area of your feet is about \$0.09m^2 = 8100mm^2\$ That's on the order of \$10^{3}\$ times more area. So your feet have a lot more area than the wire but but nowhere near \$10^{11}\$, right?
But let's try and guess the area of your entire floor or the cross section of your building. Let's just pick something small, say \$10m \times 10m\$ = \$100,000,000mm^{2}\$ That's \$10^{7}\$ times more area. Getting closer to \$10^{11}\$.
But now consider that you will get hurt by a lot less current than something like a toaster will. Just a few mA is enough. That 16AWG wire was sized to carry 15A to the toaster but you can be hurt by 5mA. That's a difference of current on the order of \$10^{3}\$. The 16AWG wire powering the toaster could be a thousand times higher in resistance and still hurt you.
So if we combine the ratio of \$10^{7}\$ and \$10^{3}\$ together, that gives you \$10^{10}\$ which is getting pretty close to the \$10^{11}\$ ratio. And remember, we used rubber which is a better insulator than most of the things the soil, floor, and building are made of. We also ignored the fact that there are grounded metal beams and pipes that let the charge take shortcuts up your building towards you.
**EDIT: Whoops, \$10^{13}\$ divided by \$10^{-8}\$ is \$10^{21}\$, not \$10^{11}\$. The biggest issue is probably that I should not have used rubber. I had trouble finding good conductivity numbers for dry wood or cured concrete. Wood varied from few gigaOhms when dry to hundreds of megaOhms with just a little bit of moisture content, to few kilOhms when damp. Resistivity of rock is surprisingly low, often much less than 10megaOhms, even when dry.
If you used a few hundred megaOhms, that would cut off about \$10^5\$ compared to using rubber so you would only need \$10^{16}\$ instead of \$10^{21}\$ more area.
https://ieeexplore.ieee.org/document/6441387
http://www.geonics.com/pdfs/technicalnotes/tn5.pdf