You can't import other files with html only. So, you have 3 methods to do this :
Server-side include (recommended) :
Use a server side language (like php) to import files.
<?php include 'header.php'; ?>
see PHP include function
Files need to be php files, but you can write it like html files.
It's better because page is rendered on server and the client receive the page with header and footer merged.
Client-side import :
Another method is to load differents parts with JS. Some frameworks (like Vuejs) comes with a components system. But, if you want to use vanilla js, you can use the fetch API
fetch('linkto/header.html')
.then(x => x.text())
.then(html => {
document.getElementById('your-container-id').innerHTML = html
})
see Fetch API
Pre render pages :
If you use an assets compiler (webpack, parcel, rollup ...), you can import html files, and the compiler will generate a new html file, in a /dist
directory for exemple, with parts imported, and other options like minify.
I never used this technique but here is a link for a parcel plugin.