a milligram (mg) is a weight, a liter(L) is a volume. However, you can compare the two using density. The density of water is 1, which means 1 liter of water weighs 1kg at a specific temperature and pressure.
10L of water weighs 10kg.
10kg = 10,000g = 10,000,000mg.
Other substances (paint, blood, milk etc) have different densities, and weigh different amounts.