The bash shell implements time as a keyword. The keyword is part of syntax of the pipeline.
The syntax of a pipeline in bash is (from the section entitled "Pipelines" in the bash manual):
[time [-p]] [!] command1 [ | or |& command2 ] …
Since time is part of the syntax of pipelines, not a shell built-in utility, it does not behave as a utility. For example, redirecting its output using ordinary shell redirections is not possible without extra trickery (see e.g. How can I redirect `time` output and command output to the same pipe?).
When the word time occurs in any other place than at the start of a pipeline in the bash shell, the external command with the same name will be called. This is what happens in the case when you put time after the pipe symbol, for example. If the shell can't find an external time command, it generates a "command not found" error.
To make the shell use the keyword to time only the sleep 1 command in your pipeline, you may use
echo foo | (time sleep 1)
Within the subshell on the right hand side of the pipeline, the time keyword is at the start of a pipeline (a pipeline of a single simple command, but still).
Also related: