If you get a nail in your tire and there's no air leaking out then yes it's safe to drive the car with the nail still in the tire but only drive the car to a tire repair shop to get the tire patched and the nail removed.
Never remove the nail from the tire until you get the tire fixed.
It's still safe to drive the car with the nail in the tire even if a little air is seeping out of the tire around the nail but drive slowly to prevent a blowout and get the vehicle to a tire shop to repair the tire.
If you have a spare it's best to replace the tire with the spare tire and then take the tire with the nail in it to the tire shop to be fixed.