miscarriage and abortion 3 years back i had to face with an relationships Problem with my ex boy friend and at that time i was pregnant. I had to abort my child at that time as a result of those problems. 

Now i am married for 10 months and got pregnant 5 Months back. i was okay till to the 11th August and i was 25th week of my pregnancy then i got to know that my child's Heartbeat has stopped and he is no more live. This was unexpected and we cannot bear this pain. 
I had that fear whether that bad karma of  previous abortion will be affect to this time.But according to the doctor everything was okay until baby's 25th week. 
We are suffering lot with this and have a fear that i will have to face the same situation in the future as well. 

I love kids so much. But once i had to done such a horrible thing due to the horrible situation with my ex. 

Please advice me how can i prevent from this bad karma and what should i do to survive from this.
3 years back i had to face with an relationships Problem with my ex boy friend and at that time i was pregnant. I had to abort my child at
  that time as a result of those problems.


If necessary, please practise loving-kindness meditation to forgive yourself for this. 

The ideal conditions for bringing a child into the world is a strong relationship &amp; family support, including financially. There are many challenges in the modern world that put pressure on women to have abortions. Please grow in understanding &amp; forgiveness.  


  Now i am married for 10 months and got pregnant 5 Months back. i was okay till to the 11th August and i was 25th week of my pregnancy then
  i got to know that my child's Heartbeat has stopped and he is no more
  live. This was unexpected and we cannot bear this pain.


I am very sorry to hear this. I do not wish to ignore your personal pain &amp; sorrow however I wish to say such pregnancy problems are common due to the fragile nature of the physical body. In the ancient Buddhist scriptures, we can read how many women &amp; children perished during child birth. Fortunately, having children today is infinitely safer than in ancient times however loss of child still occurs today due to the nature of the physical body, which is fragile &amp; can be abnormal.


  I had that fear whether that bad karma of previous abortion will be affect to this time. But according to the doctor everything was okay
  until baby's 25th week. We are suffering lot with this and have a fear
  that i will have to face the same situation in the future as well.


It is normal for a person to have the fears you have. It is normal to ask yourself: "Why did this happen?" &amp; turn to religion for answers. However, I think it is the most wise &amp; realistic action is to take the doctor's advice. I recommend to look to the modern medical profession for answers or assurances (rather than religion).

This said, about karma, the Buddha taught: "Kamma is intention". Since you did not have the intention to miscarry your baby, the miscarriage is not related to karma. An abortion is kamma but miscarriage is not kamma (unless there is direct action that leads to miscarriage, such as taking drugs, heavily drinking alcohol, playing violent sports or other carelessness). 


  I love kids so much. But once i had to done such a horrible thing due to the horrible situation with my ex.


The Buddha taught in the scriptures if we see clearly we made a mistake in life, this is a positive step in our growth as a spiritual person. The Buddha had 100% understanding &amp; forgiveness. It is good you have remorse because, as you know for yourself, abortion can make a woman unhappy. You must reflect (think) thoroughly about those good intentions for having the abortion &amp; forgive yourself, with the understanding you have learned a lesson and you are now much more careful, wise, compassionate &amp; loving in the future. Often in life, our real love for people &amp; life grows from the mistakes &amp; hurt we previously did. The Buddha taught it is from suffering the real spiritual path &amp; development begins.  


  Please advice me how can i prevent from this bad karma and what should i do to survive from this.


My advice is: 


Attend grief counselling for your loss. This is very important. 
Let go of the idea your abortion caused your baby's heart to stop beating. Generally, the reasons for such miscarriages are related to the body of the child. This webpage has explanations: Why Does The Fetal Heartbeat Stop?. 
Realise miscarriage is common in women who have not had abortions. 
Realise women who have had abortions &amp; miscarriages have later successfully had children. 
Respect yourself for the genuine remorse, love &amp; future commitment you have towards children. 
Wisely reflect the Buddha taught our sorrow is a measure of our love; the physical body is fragile; patient endurance overcomes sorrow &amp; suffering; peace comes with goodness, compassion, wisdom &amp; love.