A ventilator is a machine that helps a patient breathe by giving oxygen through a tube. A patient may need a ventilator when he or she is very ill or during and after surgery.