How soon can leaving a cavity untreated lead to tooth loss?

Depends. Cavities can progress at different speeds for different people. Check with your dentist.
Cavity untreated. Well that depends on the size of the cavity? It also depends of your eating habits? It also depends on how well you take care of your teeth? The short answer is very quickly!
Variable. Depends on the severity of decay, extent and your habits. If it is small it could take a couple years, if it is large it could take months. Know that most times cavities are larger than they appear.

Related Questions

How does not filling a cavity lead to tooth loss?

Progressing decay. It may take some time (months-years)but cavities are caused by bacteria which don't die easily. They reproduce and continue to cause probs, they will eventually get to the nerve, to the bone and destroy the structure of the tooth leaving it unrestorable.
Fracture of tooth. By not filling a cavity, the cavity will get larger and the tooth becomes weaker. At some point, the cavity will reach the nerve which will cause more pain and possibly an infection, or the cavity will get large enough that the tooth fractures. If the fracture occurs along the root of the tooth then the tooth may need to be removed.
The cavity will. Keep getting larger and larger. Eventually, the remaining tooth structure will not be large or strong enough to support a restoration (filling) and thereby determined to be non-restorable. A non-restorable tooth needs to be extracted before an infection/pain develop.

I have had several cavities for nearly a decade - one tooth is missing a third. Besides the discomfort/eventual tooth loss, is that dangerous?

Long term decay. The biggest danger other than losing your teeth is acute or chronic periapical infections (abcessed teeth). Having no pain does not mean that nothing is wrong.
Yup. Infections can not only spread to other parts of your body, but a rapidly expanding infection under your tongue can push your tongue back into your throat and kill you. Since you are aware of the problems you have, why are you waiting to restore the teeth? They are only getting worse and will eventually need extraction. Seek care before you have an emergency.
Absolutely. Your teeth are part of your body. Would you let your finger, foot, head, heart, brain rot away? I hope not. Would you let termites eat your house away? Would you leave a hole in your roof until it collapses destroying the rest of your house? While some cavities may seem inconsequential now, left untreated they can become infected and kill you.