Yes, it is generally safe to pet a hedgehog. Hedgehogs can be friendly and enjoy human interaction. However, it's important to handle them gently and properly to avoid causing them any stress or injuries. Additionally, make sure to wash your hands before and after handling a hedgehog to prevent any potential transfer of germs.