Question: How should an accidental miscarriage be seen? If family members have been praying to deities, how could it still occur?
Answer: In the Buddhist perspective, a miscarriage happens due to collective karma of  the Mother,  the Father,  the child and  all other also negatively affected family members and friends. Since this is accidental, no one in particular should be blamed. If ‘someone’ is to be deemed responsible, it is all the above together, with varying degrees each.
As much as everyone above wished the child to be born well, the child lacked adequate personal positive karma to be born so. Though there should be a sense of repentance on the part of those affected, there should be less pointless self-blame, with more prayers done for the child, to facilitate a better rebirth. The key method is in the last paragraph and first related article below.
On efficacy of prayers, there are these considerations –  Are the deities prayed to real?  If real, can they offer adequate protective blessings?  What were the prayers for? (They might not be for the child?)  Are prayers alone adequate? (There might be much collective negative karma, that need dissolving through more concrete efforts, such as doing good to help others.)
The easiest Buddhist method of creating blessings for Mother and child is by sincere and diligent mindfulness of the name(s) of Buddha(s) and/or Bodhisattva(s). Not only will children be born well, they will be wholesome too. As these enlightened beings definitely exist and have great meritorious virtues (i.e. merits), they can offer sufficient blessings for smooth conception and delivery.
What Should Be Chanted During And After A Funeral
How To Practise Repentance After Abortion?
What Did The Buddha Teach About Abortion?
Are Buddhas Omnipotent, Omnibenevolent & Omniscient?
Can Faith In Any Deity Help The Dying (And Deceased)?
Is There A Deity Who Allows Suffering?