Yes, it's possible, and technically there are a number of different ways this is achieved.
You can have a lens turret that contains multiple lenses with different focal lengths, where you rotate the turret to switch between the desired lenses—this was commonly used on movie cameras.
You can build a "stepped" zoom lens--i.e., have a lens that changes focal length, but not continuously through a range, only to pre-specified distances for which the lens is optimized (e.g., the Tri-Elmar lenses by Leica).
Or you can use a teleconverter on the back of the lens, e.g., as an add-on like the Canon Extender EF 1.4x, or an internal element that swings up into place with the flip of a switch (e.g., the Canon 200-400L—the bulge in the barrel is where the TC element lives).
Or you can use a teleside converter on the front of the lens, e.g., the Fuji TCL-X100 that converts an X1000-series camera's 35mm-equivalent lens to make it a 50mm equivalent. For the usage scenario you're describing, this is possibly the closest match that actually exists. :) But, of course, is pretty much the same as just using two separate lenses.