Our eyes detect colors using cones. There are three types of cones: S, M and L, and they are responsible for identifying the colors blue, green and red, respectively. The blue cones usually operate disjointly, whereas for most people the red and green cones might have working regions that overlap. This can be seen in the figure below.
This overlapping means that some frequencies might be perceived as both green or red, which explains why most color blindness is restricted to green and red tonalities. Of course, blue might be also hard to separate for some people, but that is quite rare.
Since both blue and red spectra are not restricted to the overlapping regions, if you could simply block all wavelength that could be interpreted as both red and green, then the affected person would be able to distinguish those colors without a problem. That's exactly what the glasses you're talking about do.
Addendum: The part "how can people interpret colors if they've never seen them before" has no place in this question. Color blind people can see colors as everybody else, they just can't distinguish some wavelengths one from another.