The novel coronavirus (COVID-19) could be described as the greatest human challenge of the 21st century. The development and transmission of the disease have increased mortality in all countries. Therefore, a rapid diagnosis of COVID-19 is necessary to treat and control the disease. In this paper, a new method for the automatic identification of pneumonia (including COVID-19) is presented using a proposed deep neural network. In the proposed method, the chest X-ray images are used to separate 2–4 classes in 7 different and functional scenarios according to healthy, viral, bacterial, and COVID-19 classes. In the proposed architecture, Generative Adversarial Networks (GANs) are used together with a fusion of the deep transfer learning and LSTM networks, without involving feature extraction/selection for classification of pneumonia. We have achieved more than 90% accuracy for all scenarios except one and also achieved 99% accuracy for separating COVID-19 from healthy group. We also compared our deep proposed network with other deep transfer learning networks (including Inception-ResNet V2, Inception V4, VGG16 and MobileNet) that have been recently widely used in pneumonia detection studies. The results based on the proposed network were very promising in terms of accuracy, precision, sensitivity, and specificity compared to the other deep transfer learning approaches. Depending on the high performance of the proposed method, it can be used during the treatment of patients.