In recent years, various types of heterogeneous networks develop rapidly. The integration of multi-type networks have great values in the fields of military and civil applications. The challenges of integrating multiple networks covers the heterogeneity of multiple aspects, e.g., the architectures, protocols, and switching mechanisms. The existing interconnection technologies of heterogeneous networks mainly include traditional static protocol gateways, traditional software-defined network (SDN) gateways, and improved SDN gateways. However, traditional static protocol gateways need to be customed in advance according to specific scenarios, which leads to the lack of flexibility. Traditional SDN gateways are often used for connecting homogeneous networks. The existing improved SDN gateways often neglect the efficiency and cost of integrating heterogeneous networks. In our work, we propose a software-defined architecture for integrating heterogeneous space and ground networks (SD-SGN). First, we propose an integrated architecture that utilizes SDN gateways and southbound interfaces to shield subnets’ heterogeneity ranging from the physical layer to the network layer. Second, we use the multi-class multi-level flow tables to provide a flexible data plane. Third, we offer an efficient control plane based on the subnet abstraction and global collaborative optimization. Fourth, we give a further discussion on customizing a complete network service based on the proposed SDN architecture. Last, extensive simulations demonstrate that this SDN architecture is effective and performs well in terms of costs, efficiency, and performance.