Mechanical ventilation plays a vital role in the treatment of patients suffering from severe lung disease. In times of a pandemic, it becomes crucial to develop ventilators that can automatically adjust parameters during the treatment process. To address this need, a study was conducted to predict the pressure exerted on the patient by the ventilator. This prediction was based on various factors, including the ventilator's parameters and the patient's condition, using a specialized model known as Long Short-Term Memory (LSTM). In order to optimize the LSTM model and improve the accuracy of the prediction results, an algorithm called Chimp Optimization Algorithm (ChoA) was employed. The combination of LSTM and ChoA resulted in the creation of the LSTM-ChoA model, which effectively addressed the challenge of selecting appropriate hyperparameters for the LSTM model. Experimental findings demonstrated that the LSTM-ChoA model outperformed other optimization algorithms such as whale grey wolf optimizer (GWO), optimization algorithm (WOA), and particle swarm optimization (PSO), as well as regression models including K-nearest neighbor (KNN) Regressor, Random and Forest (RF) Regressor, and Support Vector Machine (SVM) Regressor, in terms of accurately predicting ventilator pressure.