To avoid the adverse effects of severe air pollution on human health, we need accurate real-time air quality prediction. In this paper, for the purpose of improve prediction accuracy of air pollutant concentration, a deep neural network model with multitask learning (MTL-DBN-DNN), pretrained by a deep belief network (DBN), is proposed for forecasting of nonlinear systems and tested on the forecast of air quality time series. MTL-DBN-DNN model can solve several related prediction tasks at the same time by using shared information contained in the training data of different tasks. In the model, DBN is used to learn feature representations. Each unit in the output layer is connected to only a subset of units in the last hidden layer of DBN. Such connection effectively avoids the problem that fully connected networks need to juggle the learning of each task while being trained, so that the trained networks cannot get optimal prediction accuracy for each task. The sliding window is used to take the recent data to dynamically adjust the parameters of the MTL-DBN-DNN model. The MTL-DBN-DNN model is evaluated with a dataset from Microsoft Research. Comparison with multiple baseline models shows that the proposed MTL-DBN-DNN achieve state-of-art performance on air pollutant concentration forecasting.