Bathroom light mystery
Yes, it is possible.
You most likely had a loose connection by the switch, and when you opened it up you moved the wires around which lead to the wire touching the terminal enough for the light to work again.
Bad connections and arcing can cause heat buildup and possibly a fire. Since this is a light and not a receptacle circuit, I doubt enough current will flow for a fire to occur, but it should still be fixed.
Make sure that the power is off, open up the switch box again and hopefully you will be able to see one of the wires on the switch is loose. If not, look for a wirenut that one of the wires is coming out of. If you can't find the loose wire, check the light again.