The SFMTA makes General Transit Feed Specification (GTFS) schedule data for Muni available through the Metropolitan Transportation Commission's (MTC) Application Programming Interface (API) for GTFS data. You will need to request an API key, then download the data. This is detailed in their Open Data Frequently Asked Questions. Muni data can be retrieved with "SF" (without the quotes) as the agency code or "RG" for the entire region, including Muni.
https://www.sfmta.com/reports/gtfs-transit-data
https://511.org/open-data/transit