Yes, dynamic languages can be compiled, but not in the same sense that a compiled language is compiled.
The dynamic languages are interpreted and converted into compiled bytecode on-the-fly. This bytecode is then interpreted by the Ruby VM. Usually this bytecode is temporary and discarded after the script runs, but there are ways to "hold on" to it. The specifics depend on which Ruby interpreter you are running (JRuby, XRuby, Rubinius, etc..)
This is called cacheing the bytecode, and it saves from having to re-interpret the scripts every time you run a ruby file. PHP, Python, and other interpreted languages all work similarly (Think .pyc files in Python)
It's important to note that this bytecode that's generated is both system and interpreter-specific. It is not portable. So you cannot copy bytecode files from a linux machine and run it on a Mac.