The easiest way to do this electrically is it find a suitable mechanical switching connector. These are designed so that there are two pins (usually pcb mount) which form a pass-through RF circuit. When an external connector is mated, the connection between the two pcb pins is broken and one pin is instead connected to the external connector. The other pin is left open circuit. This latter pin would normally be routed to an internal antenna which is the default antenna when no external connector is attached.
SMA may not be the best choice for this because the switching SMAs tend to be expensive (like $15 and more) , but here are some examples:
Manufacturer : Example part number or link
Radiall : R124 422 001
Amphenol RF : 901-10416 (Digikey pn 115-901-10416TR-ND)
Aliner :
**broken link removed**
Yin Sheng Technology:
https://www.yinsheng-tech.com/en/product/SSA-0018-1B20Z25B0A0.html
I found these above with the search keywords SMA SWITCHING CONNECTOR. I'm sure there are other manufacturers.
I have not used any of these types. I have used switching connectors in pcb mount series such as those from Murata (link:
https://www.murata.com/en-us/products/connector/switchconnector) but these types are meant for manufacturing test probing and not routine use. Also see Amphenol pn 902-9049 for an example of this type.
Several of the larger manufacturers make switching coax connectors in various series including MCX, BNC and others. Types like MCX and SMB may be suitable for your application, however they are not SMA so they do not meet your stated requirement.
Other well known manufacturers that are worth investigating (depending on where you are in the world):
Hirose
JAE Electronics
ITT Cannon
Molex
Rosenberger
TE connectivity/AMP
Wurth