The cosmic bar can be made during and after the quest Elemental Workshop IV. To make one, you need to charge a primed bar on the cosmic machine in the Cosmic Room within the Workshop.
To power the machine, operate the control panel. Assuming nothing has been changed since you did the quest, one of the pillars which completes the puzzle will be out of place. You need to rotate this once. The wrong pillar can be easily found by pressing the Power button and seeing where there is a 'collision'. Place the primed bar on the machine and use the Draining Machine. You need to have at least 39 points of runecrafting remaining - if you are making multiple bars, it is recommended you bring super restores to speed up the process.
Primed cosmic bars are used in the creation of all elemental cosmic equipment including boots, gloves, body, helmet and shield. Note that 2 bars are required for a body, and 1 bar for everything else, making a total of 6 bars needed for a complete armour set.