there are many possible causes, one is viral like parvo virus, you need to vaccinate your animal against parvo virus.
Stress could be another cause.
Under or over nutrition could be also a culprit.
Timing, in breeding the proper timing is when the animal accept the boar. And as much as possible it should be done early morning or late afternoon.