Adding widgets to header and footer from plugin

Actually including that code in your theme template files is the only surefire way to include those widgets in various themes. It’s also the best to get them where you want them.

Alternatively, you could accomplish this using hooks, but that relies on your themes actually calling the hook, and in the proper location. The safest bets are the get_header and get_footer hooks, which are called just before fetching the footer.php and header.php files, respectively.

add_action( 'get_header', 'header_widgets' );
function header_widgets() {
    if( is_front_page() ) {
        get_sidebar( 'homepage' );
    }
}
add_action( 'get_footer', 'footer_widgets' );
function footer_widgets() {
    get_sidebar( 'footer1' );
}