Coronavirus (COVID‐19) is an infectious disease that has spread across the world within a short period of time and is causing rapid casualties. The main symptoms of this virus are shortness of breath, fever, cough, and a sore throat. The virus is detected through samples, such as throat swabs and sputum, taken from people who meet the possible case definition and the results are usually obtained within a few hours or a day. The development of test kits to detect the COVID‐19 virus is still an open research topic, and automated and faster diagnostic tools are needed. Recent studies have shown that biomedical images can be used for COVID‐19 testing. This study proposes the hybrid use of pre‐trained deep networks and the long short‐term memory (LSTM) for the classification of COVID‐19 from contrast‐enhanced chest X‐rays. In the proposed system, a transformation function is applied to X‐ray images first. Then, the artificial bee colony (ABC) algorithm is used to optimize the parameters obtained from the transformation function. The pre‐trained deep network models and LSTM are preferred to extract features from the contrast‐enhanced chest X‐rays. At the final stage, COVID‐19, normal (healthy), and pneumonia chest X‐ray are classified using softmax. To evaluate the performance of the proposed method, the “COVID‐19 radiography” dataset, which is widely used in the literature, is preferred. From the proposed model, 98.97% accuracy, 98.80% precision, and 98.70% sensitivity rates are obtained. Experimental results reveal that the proposed model provides efficient results compared to other methods. Thanks to the application of ABC‐based image enhancement, increased classification of 2.5% has been achieved against other state‐of‐the‐art models.