Yes! There have been decades of research put into scuba diving and how to make it as safe as possible. Diving programs have been designed to teach you everything you need to know about scuba diving safely.
This includes how to avoid running low on air, checking your air regularly, ascending slowly and safely to avoid decompression sickness, and planning your dives to make sure you stay safe. Scuba diving (like most activities) has its risks and hazards, but when a diver follows the rules that they are taught when they learn to scuba dive, it is an extremely safe activity.