Yes, an IR sensor can get a distance measurement from a wall at an angle. Most surfaces are not perfectly smooth therefore they scatter light (IR) in all directions thus the distance sensor can get a reading.
I've found that its the very smooth, shiny surfaces that the distance sensor has trouble detecting.