I was wondering if it was possible, by using only lenses, mirrors, or prisms, to rotate a ray of light coming from a certain direction. For example, if I have two lasers beams side by side, is it possible that after going through an optical setup, that the laser beams appear one on top of each other? I don't want to use stuff like optical fibers or electronics, I just wish to know if it is possible to do it with purely optical devices.
Yes, it's necessary for example on some telescopes to keep the image the same way up on a camera as the telescope tracks across the sky. VLT naysmyth focus
There are a couple of optical designs, using either rotating prisms or a rotating set of mirrors. Look up field rotator. eg http://www.ing.iac.es/~eng/optics/documents/OPT-WHT-001.pdf
Yes you can. Moreover, you don't need any lenses and such things, you only need a medium with Refractive index $n(\vec r)$. Using Fermat's principle (https://en.wikipedia.org/wiki/Fermat%27s_principle) you can calculate the path of the light travelling through a medium with $n(\vec r)$. You just have to choose a proper $n(\vec r)$ function.