What has happened directly before the photos have vanished from the Shared albums?
Are you the owner of the Shared albums or a subscriber?
If you just installed a system upgrade and the Shared albums have become disabled, the cashed, downloaded photos from the shared albums will have been purged and Photos will have to download them again from iCloud, Only the photos that are still iniCloud will reappear. f the person who added the photos to the shared album has removed them from the shared album, you will still be seeing the photos in the shared albums on your other devices, but not on the device where Shared albums have been turned off.
That is why it is essential to save all photos from a shared album, before you toggle Shared Albums off.
As Nathan wrote - it may take up to a day or longer for the photos to reappear, after you enable the Shared albums again, but there is no guarantee, that all will come back. It will depend on what is still in iCloud.