This is mainly a historical question. In Gary Hatfields introduction to Kants Prologomena, he says:
After the discovery of non-Euclidean geometry, Kant’s claims for the synthetic a priori status of Euclid’s geometry as a description of physical space came into question.
He doesn't explicitly say, but is it implied that this had an impact on Kantian thought outside of his conception of mathematics.
Neo-Kantians such as Cassirer questioned whether the categories of human understanding are truly fixed, as Kant had suggested, or change throughout the history of human thought.
If geometry can change, perhaps categories can?
My own thinking on this is that mathematicians from antiquity had already recognised the lack of neccessity in the parallel postulate, and that this shows that they already understood Euclidean geometry wasn't a priori as then constituted. That it took millenia for this insight to be incorporated in the main body of mathematics as refutation alongside the discovery of non-Euclidean geometry is a mere side-issue from this essential insight.
addendum
I don't see how either the mathematical discovery of non-euclidean geometries or the physical discovery of non-euclidean geometry of spacetime invalidates Kants reasoning. Physically, in general relativity it is the large-scale geometry that is non-euclidean; and in the small-scale, that is locallY - the scale appropriate to direct human perception (that is not magnified by extra-sensory instruments) - it is euclidean. But this is besides the point; even were we to park ourselves close to somewhere where gravitational forces appreciably altered the curvature of spacetime - I think our direct understanding of space and time would remain euclidean. That is we would see for example a ball following a curved geodesic in spacetime as curved in space and through time and not a straightline.

