The context of the poem is the 19th century beginnings of the women's movement, the slow descent of the aristocratic rule and the also slow process of women gaining entrance and respect in the field of education.
In this poem, Tennyson uses the damsel in distress character to represent the princess, who has been bethroded to a Prince, and has lived her entire life within the walls of a gorgeous castle, and presumably has everything she needed to be happy. Yet, contrary to the expectations of her class, she wanted more than anything to be educated.
So, she went ahead and, in anger against the men who open colleges that women cannot attend, she opened a college for women to which men cannot attend. This sounded weird to her bethroded Prince, so he embarked on a mission of dissuading her and bringing her back.
The comedic part of the poem is that he and his knights had to dress like women to be able to enter the college to "save" the princess, and got discovered and beat down once found out.
In the end, the women help the men come back to health and the princess marries the prince. Basically, this was one of the very first pieces of literature written by a male which advocates in favor of the need for women to be educated.