In robotics, sensors like ultrasonic sensors and IMUs play pivotal roles by enabling robots to sense their environment, avoid obstacles, and maintain balance and orientation during tasks. These sensors enhance a robot's capability to navigate and interact with its surroundings effectively.