An electronic device comprising: a first housing; a second housing coupled to the first housing in a movable manner with respect to the first housing; a flexible display (110, 310) disposed on the first housing and the second housing, and having a structure that is changeable with a movement of the second housing; a camera module (131, 132, 133, 134) in which an optical magnification can be set; and a processor electrically coupled to the flexible display (110, 310) and the camera module (131, 132, 133, 134), wherein the camera module (131, 132, 133, 134) comprises: a first camera holder (510, 1210, 2410) coupled to the first housing and comprising a first lens module (910, 1230) disposed along a first optical axis; and a second camera holder (520, 1220, 2420) coupled to the second housing and comprising at least a second lens module (920, 1243, 930, 1253, 940) disposed along the first optical axis, wherein the second camera holder (520, 1220, 2420) is movable along the first optical axis with respect to the first camera holder (510, 1210, 2410) with the movement of the second housing, and wherein the processor is configured to: identify the movement of the second housing; identify an arrangement state of lens modules that satisfies the identified movement of the second housing and the optical magnification; and move the first lens module (910, 1230) and the second lens module (920, 1243) to be in the identified arrangement state. a first housing; a second housing coupled to the first housing in a movable manner with respect to the first housing; a flexible display (110, 310) disposed on the first housing and the second housing, and having a structure that is changeable with a movement of the second housing; a camera module (131, 132, 133, 134) in which an optical magnification can be set; and a processor electrically coupled to the flexible display (110, 310) and the camera module (131, 132, 133, 134), wherein the camera module (131, 132, 133, 134) comprises: a first camera holder (510, 1210, 2410) coupled to the first housing and comprising a first lens module (910, 1230) disposed along a first optical axis; and a second camera holder (520, 1220, 2420) coupled to the second housing and comprising at least a second lens module (920, 1243, 930, 1253, 940) disposed along the first optical axis, wherein the second camera holder (520, 1220, 2420) is movable along the first optical axis with respect to the first camera holder (510, 1210, 2410) with the movement of the second housing, and a first camera holder (510, 1210, 2410) coupled to the first housing and comprising a first lens module (910, 1230) disposed along a first optical axis; and a second camera holder (520, 1220, 2420) coupled to the second housing and comprising at least a second lens module (920, 1243, 930, 1253, 940) disposed along the first optical axis, wherein the second camera holder (520, 1220, 2420) is movable along the first optical axis with respect to the first camera holder (510, 1210, 2410) with the movement of the second housing, and wherein the processor is configured to: identify the movement of the second housing; identify an arrangement state of lens modules that satisfies the identified movement of the second housing and the optical magnification; and move the first lens module (910, 1230) and the second lens module (920, 1243) to be in the identified arrangement state. identify the movement of the second housing; identify an arrangement state of lens modules that satisfies the identified movement of the second housing and the optical magnification; and move the first lens module (910, 1230) and the second lens module (920, 1243) to be in the identified arrangement state.