Bunk beds require metal tubes, or rods, to attach the top bunk to the lower bunk. Using bunk beds without the rods is very dangerous and should never be done. However, finding replacement rods can be challenging if you no longer have the original ones. Being resourceful and finding replacement metal rods can make your bunk bed safe and useable again.
Contact the furniture manufacturer of your bunk bed to see if they sell replacement rods. If you don't have luck with the manufacturer, call or stop by the store you purchased the beds from to see if they have any spare metal rods from beds that were broke or otherwise unsellable.
If you are unable to locate replacement pieces, get creative and make your own rods. Measure the hole where the rods should go on the bunk to find the diameter. This is done by measuring the distance across the center of the hole.
Find the length of the hole by measuring from the inside of the hole to the top of it. Use a thin tape measure placed in the hole or other object to find the depth. Whatever the depth measurement, your replacement rod should be double that size, or for accuracy, also measure the depth of the hole in the top bunk bed. Normal size for bunk bed rods are about ¼ inch in diameter by 2 ½ inches long (Reference 1).
Buy a smooth bolt from your local DIY or hardware in the specified diameter and a little longer than your measurements. You may only find a piece with part of it smooth and part with threads, which should be sufficient. The head of the bolt will be cut to create a fairly smooth, straight rod. The threads may be sanded, if they are deep, to prevent chafing of the wood and stretching of the hole.
Place the bolt in a vice clamped around the threaded end. Saw the bolt head off with a blade designed for metal (hack saw should work). Cut the bolt to the appropriate length for your measurements and file rough ends with a metal file. Place rods in lower bunk bed holes to check for accuracy and proceed to lower the top bunk in place.