If your iPad’s auto-lock is not working, here are a few things you can try:
Check your settings: Make sure that Auto-Lock is turned on in Settings > Display & Brightness.
Restart your iPad: Force restart your iPad by holding down the Sleep/Wake button and the Home button at the same time until you see the Apple logo.
Update your iPad’s software: Make sure that your iPad is running the latest version of iOS.
Reset your iPad’s settings: Reset your iPad’s settings by going to Settings > General > Reset > Reset All Settings.
Restore your iPad: If all else fails, you can restore your iPad to factory settings.