Energy security and the transformation of energy systems towards a sustainable energy supply are two central challenges with respect to planning the expansion of gas infrastructure. Taking the gas transmission system in Germany as an example, this work examines how the transformation of energy systems affects energy security in the long term (up to the year 2050) and why this should be taken into account when planning the expansion of transmission networks in the short to medium term. To achieve this, we use energy system modeling to derive scenario based future gas demands and our optimization model GASOPT to solve derived load flow problems. The results show how gas can act as a bridging energy source in the transformation of energy systems from a fossil-based to a renewable energy supply, as it produces comparatively less climate-damaging emissions than coal and oil. However, the gas demand decreases in both the energy transition scenario Energiewende (−55,0% by 2050 compared to 2015) and the current measures scenario Reference (−72,1%), leading to an increase in natural-gas-related energy security. This is understood as an interaction between import dependency, security of supply, and affordability. Load flow analyses of the current grid design considering lacking imports or empty gas storages with combined full load operation of gas fired power plants demonstrate the technical feasibility of challenging grid situations in the long term. Further significant transmission grid expansions should therefore be avoided, with freed-up transmission and storage capacity instead being used for other gaseous energy sources such as hydrogen or other gases.