This generally happens when you have turned off Location Services or location sharing, Screen Time restrictions are preventing it, or you simply haven't signed in to iCloud. Head to Settings, Privacy & Security Location Services, and double-check that it is turned on. Look at Find My and enable location sharing. Moreover, verify that the date & time are on automatic setting and you are connected to the internet.