A novel autofocusing technique using a self-imaging approach is developed for a space camera having large aperture and long focus. Its optical system consists of an emitting system, receiving system, and two pentagonal prisms. The emitting system has three parts: a light source, beamsplitter, and aim slit. The receiving system includes a field lens, two separate lenses, and CCD. Using two little pentaprisms instead of a large planar mirror makes the autofocus system simple and compact. A defocused signal is acquired by measuring the change of the slit self-image position imaged on the CCD. The algorithm to calculate the movement of the slit self-image position is analyzed to achieve subpixel position estimation. The results of the experiments show a ±10-µm precision of autofocusing in a range of ±5-mm defocusing. The system demonstrates high resolution, easy adjustment, and high reliability. Also this method can meet the requirements of various accurate focus measurement systems.