Welcome to Healthcaremagic.
The history of miscarriage
is not related to the pain you have.
Well, yes it could be due to urinary tract
lesion or due to stones in the urinary tract
To rule out both above possibilities you may have to get a routine urine microscopy test which can give clue into further management.
Wish you good health.