Much of your iPad and iPhone's advanced functionality simply won’t work unless a Passcode has been initially set - such as TouchID/FaceID and Keychain stored passwords - and for this reason alone it is almost certain that a Passcode has been previously set, even if the auto-lock function was subsequently disabled.
Your device passcodes are literally the key to storing and exchanging encrypted data between your devices. In certain circumstances, you'll be prompted to enter the Passcode that you use with a different device - this being required to successfully reset the encrypted connection between devices that are sharing data via iCloud. Unless you can enter the correct passcode, some functions and data synchronisation will cease to work. If your devices are to continue to interact with each other as expected, you'll need to enter the passcode as prompted.
A forgotten/unknown device passcode cannot be recovered - and neither can it be reset or modified from another device.
You may find this support page to be helpful:
If you see an iPhone or iPad unavailable message or Security Lockout screen - Apple Support
iOS/iPadOS 15.2 or later with a forgotten/unknown Passcode
Apple has introduced a procedure with which to reset an iPad or iPhone with a forgotten Passcode - allowing you to use your AppleID and associated Password to reset your device.
How to reset your iPhone, iPad, or iPod touch when you forgot your passcode - Apple Support
You will be able to restore data from a pre-existing iCloud backup without the use of a computer, but will require a PC/Mac to restore data from an iTunes backup.
iOS/iPadOS 15.1 and earlier - and all devices that are Disabled
If your iPad or iPhone has been disabled, or you have forgotten your iPad passcode, you have no alternative other than to follow this process with the relevant device:
If you’ve forgotten the passcode on your iPad, or your iPad is disabled – Apple Support
You’ll need access to either a Windows PC (with iTunes installed) or a Mac (with iTunes or Finder - as appropriate for the installed version of MacOS).
Download and use iTunes for Windows – Apple Support
Update to the latest version of iTunes – Apple Support
Use of a PC or Mac is unavoidable. If you don’t have access to a suitable computer of your own, that of a helpful friend or family member will suffice. Alternatively, the technicians at the Genius Bar of your local Apple Store will be delighted to assist.
Genius Bar Reservation and Apple Support Options - Apple
You may also need your AppleID and associated password. If these have also been forgotten, they can be recovered here:
https://iforgot.apple.com
More information about recovery of your AppleID and associated Password:
If you forgot your Apple ID - Apple Support
If you forgot your Apple ID password - Apple Support