Is hyperglycemia be related to the pregnancy loss?

Probably. Diabetes during pregnancy can be a problem or not depending on how closely the diabetes is controlled. Generally, the better the conrtol the better the outcome. Since there was hyperglycemia, it probably was related to the loss. One should realize, however, that pregnency losses can happen in women who do not have diabetes.