Countries without large national armies still need to defend themselves. A lot of rich countries do not have high populations, but they are still able to pay for mercenaries. In this way, professional soldiers from poor countries can find work, and rich countries can adequately defend themselves. It works out for everyone.
In weak states without functioning national armies, mercenaries can be a suitable alternative. While they often come with their own set of problems, it is better to pay for the services of a professional army than to let a state be overrun by various enemies and further destabilize it. Mercenaries should only be used as a last resort, however.