Drush API for downloading module from a script
If there's an API for this, I think it would be drush_invoke_process. I believe Drush uses that function internally when one command wants to execute another.

The primary function that executes the download work is drush_pm_download(), so you could probably just call it directly as well.

And of course, as a last resort, you could use exec(drush @alias dl $module).