Why were the middle ages romanticized in the 19th century?
I am not fully versed in 19th century ideologies, so if I miss something forgive me. But I do know that it emerged as a result of the Industrial Revolution. From the point of view of the 19th century romantics, industry showed a destruction of nature, and they wished to return to a more agrarian, bucolic, and simple existence in harmony with nature. The largely agricultural society of the middle-ages was idealistic in this sense.
However, romanticization of the middle-ages was not only prevalent among romantics, but also conservatives. Again, this was in response to the Industrial revolution, but not its environmental repercussions, rather its social ones. The advent of marxism and the expansion of the middle-class, as well as the willingness of liberalism to increase enfranchisement, seemed to threaten the 'natural hierarchy' of things. For them, the middle-ages hearkened back to a time where this natural order existed and worked harmoniously through feudalism.
As far as the 'Pre-Raphaelite Brotherhood' is concerned, they fall (somewhat) into the category of the former paragraph. For them, their romantic notions had more to do with the prominence of spirituality in the Middle Ages which, in their estimation, had been absent in their present day. Again, the advent of industrialization is what caused these views. The alienation and spiritual void in which factory laborers lived, the materialism among the burgeoning middle class, and the emergence of the market culture probably had a hand in their disillusionment with 19th century Western society. As a result, their paintings attempted to evoke a kind of spirituality of the middle-ages which, interestingly enough, commingled with realism and naturalism. Even more interestingly, the two artistic tendencies both stemmed from the same disillusion, despite the fact that historical medieval art was anything but realistic. It's those types of things which make you see how the realities of one era affect how previous eras are perceived and - off topic - how that can cause beautiful and terrible marriages of ideology.
Anyways, I don't know all that much beyond that. But if you have questions, I can snoop around some books and maybe find an answer for you. In any case, I hope I was able to answer the question to your satisfaction.
Do you have a particular country (or two) in mind? Or did a particular group of people inspire this question (the Pre-Raphaelite Brotherhood, for example)? Narrowing this down a bit could better help us answer your question.