Inspiration and expiration is dependent on a pressure difference between the lungs and the external atmosphere. The atmosphere of Earth is roughly 1 atmosphere which equates to 760mmHg (millimetre of mercury). Whereas the pressure in our thoracic cavity, which houses our lungs, fluctuates from 762mmHg to 758mmHg and this pressure difference either causes air to rush out of the lungs or into the lungs.
As you may know air follows the pressure gradient which is why air is pulled into our lungs during inspiration. The intercostal muscles and diaphragm contract moving the ribs up and out, decreasing the pressure within the thoracic cavity. Now that the pressure in the thoracic cavity is decreased to roughly 758mmHg air will follow the pressure gradient and rushes into the lungs. The relationship between volume and pressure is explained by Boyles law, I will discuss this at the end.
Conversely to inspiration the intercostal muscles and diaphragm relax moving the ribs down and in. Therefore, increasing the pressure in the thoracic cavity to roughly 762mmHg. Air rushes out of the lungs down the pressure gradient and into the Earths atmosphere.
Discusses the relationship between volume and pressure. As the volume of a system decreases the pressure increases and as the volume of a system increases the pressure decreases. This can be seen in the image below. This phenomena allows us to breath.
In addition, the two are linearly related which means that if you decrease the volume by 0.5 then the pressure would increase by 0.5.