Hello Miroslav_MKA,
Thanks for visiting the Apple Support Communities and asking about your Wi-Fi turning off automatically. I am happy to help.
1. Restart your device. Restart your iPhone, iPad, or iPod touch - Apple Support
2. If the issue returns after that, try force restarting your device. If your iPhone, iPad, or iPod touch won't turn on or is frozen - Apple Support
"On an iPhone 7 or iPhone 7 Plus: Press and hold both the Side and Volume Down buttons for at least 10 seconds, until you see the Apple logo."
3. If the issue is still occurring after those steps, I recommend making a backup before the next steps. You can make a backup in iCloud or iTunes using this article: How to back up your iPhone, iPad, and iPod touch - Apple Support
4. After your data is backed up, I recommend reinstalling the iOS using iTunes. The reason we need to use iTunes for this step is to get a new copy of iOS installed to your device. Use this article to reinstall the iOS: If you can‘t update or restore your iPhone, iPad, or iPod touch - Apple Support
Please pay close attention when you reach step 4. Once your iOS is reinstalled, test if the issue is still occurring. Thanks again and have a great rest of your day.