As a key parameter of the ionosphere, the critical frequency of the F2 layer of the ionosphere (foF2) is of great significance for ensuring the stable operation of systems such as high-frequency radar and short-wave communication. This paper proposes a short-term forecasting method for the ionospheric foF2 based on deep learning. By using the Bidirectional long short-term memory model with attention mechanism (BiLSTM-Attention) algorithm and combining the observed values of the ionospheric foF2 at the ionosonde station for the previous 7 days, universal time, solar activity index, and geomagnetic activity index as inputs, the forecasting of the ionospheric foF2 in the Chinese region is realized. The results of the comparative analysis of the model show that: 1) The forecasting error of the low-latitude stations is significantly higher than that of the mid-latitude stations. The BiLSTM-Attention model performs the best, followed by the long short-term memory network (LSTM) model. Compared with the International Reference Ionosphere model (IRI), the root mean square error (RMSE) of the BiLSTM-Attention model is reduced by 54%, the mean absolute error (MAE) is reduced by 57%, and the coefficient of determination (R2) is increased by 28%. 2) During geomagnetic storms, the BiLSTM-Attention model successfully captures the negative storm effect of the ionosphere in the Chinese region (the decrease of foF2), which is in good agreement with the observed values, while the IRI model cannot represent the significant deviation caused by the disturbance. Although the IRI model is overall close to the vertical sounding observations during the geomagnetically quiet period, there are still systematic errors in the periods after sunset and at night. 3) As the forecasting time increases from 1 hour to 24 hours, the forecasting error of the model shows a systematic upward trend, with the RMSE increasing from 1.02 MHz to 2.03 MHz and the MAE increasing from 0.71 MHz to 1.55 MHz. Relevant research provides high-precision ionospheric parameter forecasting support for space weather warning and short-wave communication system optimization.