So as far as I understand you need to spent your own population to build ground troops. If true than that means ground troops are insanely valuable and that losing them is the same as basically losing portions of your empire.
They are very valuable, keep them protected!
However, I still have some questions about how land units work. For example, if I build a transport and convert 1 population into a army unit, then will the planet just replace that population unit with time by making the population grow again?
Yup. Population constantly replenishes up to the food capacity (unless you're a Synthetic life-form, then you have to build pop).
You may have a shipyard served by 3 or more planets, which means a transport module would take 1 billion from each planet. If you have decent population growth (can be improved by building hospitals, researching some techs, etc.) that will replenish itself in no time.
If so does that mean that it pays to have land units ready in advance so that once a war happens you won't suddenly have to deplete all your colonies of population?
It can do - but that means you have to protect them from pirates and other hazards too!