If a miscarriage is going to happen for the embryo's own reasons, you can't prevent it, and most miscarriages happen for the embryo's own reasons.
Taking progesterone helps IF the problem that causes pregnancy loss is that the woman has low progesterone, but it doesn't do anything if the problem is that the embryo is missing cells or something else that it needs.
Eating well and taking care of yourself is great during pregnancy, but women in war zones who are refugees on the road get pregnant, so a bad diet and lots of stress will not necessarily cause a miscarriage.
Except in cases where a woman has actually ingested something dangerous to the embryo, miscarriage is almost never because of something the woman did or didn't do. It's almost always because at the original linking of the egg and the sperm, something got lost. The embryo will develop until that thing is needed and then the thing is not there and it will stop developing. If that is happening, no medical intervention would be able to save the embryo.
Progesterone helps lower miscarrage
You can't prevent one but you can take steps to have a healthier pregnancy and reduce the chancesof a miscarriage like eating right, staying active, not using drugs or drinking alcohol, etc.. Some things are just unavoidable though and if the developing baby isn't a healthy and viable baby, there isn't anything you can do about that.