As others have said, this is because the
sh has been redirected to read from the pipe, it is not connected to the terminal as it would normally be. One thing you can do to get around this is to use
/dev/tty to force the script to read from the terminal. Eg:
read -p "Are you sure [Y/n]?" line </dev/tty
case "$line" in
y|Y) echo "confirmed"
*) echo "not confirmed"
Normally you would only do this if you specifically want to prevent people from scripting the input, eg:
echo Y | sh confirmation.sh
This would still read from the terminal even though the user might expect this to automatically input
Y at the prompt. It is common for programs that expect a password to do this.