how to set a variable in module and get it in theme
HOWEVER:

You should really look into the various _preprocess() hooks.  From further commentary below, I am thinking that's where you should be doing all this.

ORIGINAL ANSWER:

If you don't want to use the system wide variable_set() or variable_get() you can always set a variable in the global $_SESSION array that would be seen by the current logged in user only, eg,

if ( // whatever ) {
  $_SESSION['MYMODULE_variable_name']= // whatever
}


SUPER DUPER OVER SIMPLIFIED ADDITION:

function MYMODULE_foo($value=NULL) {
  static $bar;

  if ($value) {
     $bar=$value;
  }

  return $bar;
}


accomplishes it inside your module, eg, you can do:

MYMODULE_foo('this is cool');


and then in your theme do:

$baz=MYMODULE_foo();