How to query for all highways in Overpass API (demo: overpass-turbo.eu/s/3sB):

<osm-script output="json">
  <query type="way" into="highways">
    <bbox-query {{bbox}}/>
    <has-kv k="highway" />
  </query>
 
  <union>
    <item set="highways"/>
    <recurse from="highways" type="down"/>
  </union>
  
  <print mode="body" order="quadtile"/>
</osm-script>

This returns all highways without filtering, check out the OSM Highway docs for different possible types of highway, and add a v="" attribute to the has-kv element to filter.

updated: