Ribs are designed to move by virtue of their attachment to the sternum via the costal cartiledge and their attachment to the spine via joints. The costal cartiledge is spongy and flexible, allowing the ribs to swing up and out. In fact, when the ribs swing up and out upon inhalation, they twist the cartiledge, storing energy in the cartiledge. When we exhale, the energy is released, in a phenomenon known as elastic recoil.
It’s the ribs moving that causes the thoracic cavity to expand in volume and the air to rush in.
It’s not the air rushing in that causes the ribs to move – that’s backwards! Rib motion is a primary motion of breathing.