A site that needs mod_rewrite fails in confusing ways when the module is off. I’d rather ask Apache than read config files.
On Debian and Ubuntu, a2query reports the state of modules. Give it a name:
a2query -m rewrite
When the module is enabled it prints something like rewrite (enabled by site administrator). When the name matches nothing, it prints No module matches and the exit code is 1, so you can use it in a script. Without a name, a2query -m lists all modules.
If the module is off, a2enmod rewrite enables it. That works by creating symlinks in /etc/apache2/mods-enabled, and the output tells you to restart Apache to activate it.
A caveat: the a2* helpers are a Debian family thing. On other distributions Apache keeps modules in different places and these commands don’t exist.
Further reading: a2enmod man page (Debian)