Did they simply raise their taxes? Did they borrow from wealthy aristocratic lenders? Or were there other mechanisms in use?
You may consider specifying a bit what historical period you have in mind besides it being before WW1. Public debt had been used before the Great War for the purpose of funding the military, albeit arguably on a much smaller scale - Italy for instance had made specific debt titles emissions during its third independence war, while it had relied in larger measure on the Rothschild House (and other traditional bankers) for the previous two.
The chance to finance through (internal - maybe the one you are thinking about in your question) debt was strictly dependent on the development of the internal finance system in a "modern" way - similarly a parallel way was the abandonment of the gold standard; another measure that Italy had to undertake during it third independence war.
To see where and when the use of debt (or even public debt as we conceive it now) became prevalent, you should trace the evolution of the financial system of each nation in its international context.
Or, if you want to see how governments acquired funds before any use of debt, you may have to go back much further than WW1.
Anyways, I think it would be helpful if you could specify a bit where and when.
Unfortunately, I can't really provide a general answer on the topic - besides having some sparse knowledge on the way Italian finances worked before WW1 - so I am posting this only as a follow up clarification in hope to help you get the answer you are looking for.