Spatial pyramid pooling (SPP) divides a feature map into grids at several levels of coarseness, takes the maximum in each bin, and concatenates them into a single vector. Because the bin size is proportional to the feature map size, the resulting vector has the same length whatever the feature map's dimensions. It has no learnable parameters.
He et al. proposed SPP-net in 2014, a network that inserts an SPP layer into a CNN. CNNs at the time could only accept images of a fixed size such as 224×224. Images were therefore cropped or warped to fit, but cropping cuts off parts of the object and warping distorts its shape.
The paper pointed out that the fixed size requirement comes not from the convolutional layers but from the fully connected layers at the end. Convolutional layers can be computed on images of any size, but fully connected layers need an input of fixed length. The paper therefore replaced the last pooling layer, between the last convolutional layer and the fully connected layers, with an SPP layer, so that a vector of the same length can be produced from a feature map of any size.
In the example in the top figure, a 6×6 feature map is divided into 3×3, 2×2 and 1×1 bins, and their maxima (9, 4 and 1 values) are concatenated into 14 values. Whether the feature map is 13×13 or 10×10, only the bin size changes; the output stays at 14 values.
The idea comes from spatial pyramid matching (Grauman and Darrell 2005, Lazebnik et al. 2006), widely used in image recognition before deep learning. It adds grids that coarsely preserve spatial information to Bag-of-Words, which summarizes the features of a whole image into one, and SPP-net applied this to the feature maps of a CNN.

