1.Go to the SharePoint admin center -> Policies -> Sharing -> Check the setting "Guest access to a site or OneDrive will expire automatically after this many days".
2.Go to the SharePoint admin center -> Sites -> Active sites -> Select the site -> Sharing -> Check the setting "Guest Access expires automatically after this many days".
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.