Urine can in fact be used in the manufacture of gunpowder, and it has historically been a very important source of one of the crucial ingredients in gunpowder — saltpeter, also known as niter. This nitrate compound is what allows gunpowder to rapidly oxidize and catch fire, generating an explosion that can be used to fire munitions. In the modern era, there are less smelly ways to get saltpeter, typically through an industrial process that uses ammonia as a base.
While you cannot literally make gunpowder from urine, as you need several other ingredients to produce it, urine can certainly be used to produce one necessary element. In addition to saltpeter, however, you would also need charcoal and sulfur. These ingredients are both readily available, unlike saltpeter, so the popular stories about using urine to make gunpowder do have a rational basis. Until World War I, before people learned to reliably synthetically produce niter, urine, guano, and manure were all collected to produce gunpowder.
Initially, saltpeter was scraped from the walls of stables, but this source quickly proved to be insufficient, so people started collecting urine and dung to access the valuable nitrates. To extract saltpeter from urine historically, gunpowder manufacturers set up “niter beds” of straw, filtering the urine through the straw, which would concentrate the salts for easy collection. Urine has also had a number of other uses, and competition for available resources could sometimes be fierce, which may explain why many nations continued to use bladed weapons after the development of firearms, as making gunpowder was expensive and time consuming.
During various times of war historically, citizens have been asked to collect urine and dung so that gunpowder manufacturers could use these products. Making gunpowder is a hazardous practice, and not recommended for people who are not experienced, although some people do make their own black powder at home for hunting and historical re-enactment. Some historical societies sometimes offer demonstrations that involve making gunpowder from urine, among other things.
If the topic ever comes up, you may also want to be armed with information about other historical uses of urine. Urine has been, and continues to be, used as a nitrogen-rich fertilizer in some regions of the world. It is also used to repel animal pests, who shy away from urine deposits in the garden or on the trail. Urine has also been used in bleaching historically, and to help prepare textiles for dyeing.