Hello Frederica
No SBB trains In France, the name of the railway company is SNCF. It is necessary to buy tickets in advance only for the TGV.
For the region Grand Est, you could buy a « carte fluo » for 20 € which gives you a reduction of 50% on the regional trains (TER). This card and the tickets are available on sncf-connect.com or in the SNCF Connect app. Tickets are also available on vending machines in the stations.
For Switzerland you must buy tickets in advance to obtain Supersaver Tickets (valid only in the selected trains) and Saver Day Passes (valid in every train), but they are not refundable and not exchangeable.
Kind Regards
Danhiel