Piping data to ogr2ogr
OGR has its own idiom for stdin, /vsistdin/
. Use that as ogr2ogr's first argument (the dst_datasource_name) and you can pipe curl's output to it:
curl "https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_50m_admin_0_countries.geojson" | ogr2ogr -f "KML" countries.kml /vsistdin/
You can use URLs as paths to OGR data sources, so you don't need curl or pipes.
ogr2ogr -f KML countries.kml https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_50m_admin_0_countries.geojson