Mechanics in robotics is used to design and analyze the movement and operation of robots, focusing on elements like kinematics, dynamics, and control. It helps in determining joint movements, force distribution, and stability to achieve desired functions such as navigation, manipulation, and interaction with environments.