I was thinking of using a motion sensor to trigger the esp32-cam to take a picture but does it requires wifi to do so?
No, you don't need to use Wi-Fi to take a picture with the ESP32-CAM.
No, ESP32CAM can take a picture and save it to the microSD card.
Plenty of tutorials out there.
BTW - You may like to have a look at my sketch where I use the camera it's self to detect motion: https://github.com/alanesq/CameraWifiMotion
(The motion detection code is in motion.h)