A medial moraine forms when two glaciers merge, and their lateral moraines combine into a ridge of debris running down the center of the new glacier. This ridge, positioned along the combined glacier's flow line, symbolizes the geological boundary between the originating ice masses.