A typical commercial Aircraft will lower its landing gear approximately 6 to 7 nautical miles (11–13 kms) before touching down on the runway. Vertically somewhere between 1800–2500 ft.
Although lowering the landing gear creates a lot of drag and a drastic increase in fuel consumption,
it is lowered at this distance and altitude so the approach is stabilized by the time it is about 1000 feet above the airfield elevation and may continue to a safe landing.
A last-minute lowering may cause the approach speed to be too high or the aircraft to be un-stabilized. Also, if there’s a fault with the opening of the landing gear bays or the landing gear not being down locked, the aircraft has sufficient margin to conduct a safe missed approach.