Say I have a site at
Can I view that page using a specific commit to that repository? For example,
myname.github.io/repository.html?commit=397cb59 or something similar, to view past versions of that page?
No, the rendered versions of GitHub pages are not archived.
You can build such an archive yourself by following for example these instructions - although this would become a bit cumbersome to do for each commit. You could automate it though via CI.
If you only need the source code of the page, not the rendered result, you can of course just browse your repository and select the commit you are looking for.
If your site is reasonably popular, it is probably indexed by the Internet Archive's Wayback Machine. This won't let you choose a specific commit, but you can look through the old versions archived to possibly find the matching one.