For various reasons. There are two main reasons to sedate patients. First is for comfort, having a breathing tube or getting stuck for procedure is uncomfortable and allows patient to tolerate these interventions. A second reason is when patients are critically ill you want to control various physiologic parameters such as breathing and heart rate. We sedate people so we can manipulate these factors.
Comfort. Historically it has been felt patients need to be sedated to tolerate the procedures administered in the intensive care unit such as mechanical ventilation. Also many patients are delirious as a part of their illness and are sedated to avoid removing tubes/ catheters. More recent evidence suggests patients actually do better if the sedation can be minimized, to the extent this can be done safely.
Discomfort. It's uncomfortable to be critically ill and often support equipment is needed to correct the physical problem. This includes ventilators and dialysis machines. For comfort and also safety, sedation is necessary.
Comfort. Icu patients often have tubes (example endotracheal tube, central lines, etc) and these tend to be quite uncomfortable so to keep patients comfortable, they ate sedated. Another reason is that these tubes/lines need to be maintained and they can become dislodged with movement so patients are sedated to avoid this from happening.