The uterus is normally sterile but during or after calving, environmental microorganisms can enter and cause infection, especially as the cervix is still open for a few days during involution when it's all shrinking back down.
Metritis is an inflammation of the uterus which occurs directly after calving. Endometritis is a common condition which occurs 21 days or more after calving. The main problem with this is that it will reduce fertility and delay the next conception, increasing the calving interval, decreasing the milk yield and costing the farmer more money.
Then we went per vaginam and treated (or prevented) the infection by placing a broad spectrum antibiotic bolus directly into the uterus or cervix.