Every Jyotirlingam has a different story behind how it came to be. There is a Sthala Purana (local folklore or legends) attached to each. For example, Lord Rama went to Rameshwaram and established the Jyotirlingam there by worshipping Lord Shiva.
The aim was to unite all the people of India by one single thread of devotion.
Different people in India speak different languages. In Kashi (now Varanasi) there is a different language, in Rameshwaram there is a different language. In ancient times, people were told to visit Rameshwaram, and then from there they were told to go on a pilgrimage to Kashi and bathe in the holy Ganges. After that they were told to bring back with them the holy water of the Ganges from Kashi to Rameshwaram and offer it to the Jyotirlingam there. And after that, they were told to take the offering back to the Kashi Vishwanath temple.
The intention behind doing this in the olden times was to bring a sense of national unity (by visiting these holy shrines situated in different parts of the country). Taking holy water of the Ganges from Kashi to Rameshwaram has no meaning or importance to Lord Shiva. Yes, but there is a certain significance in it for the country.
When people undertake pilgrimages together to different parts to the country, they establish bonds of friendship with one another.
And whenever we do anything with a sense of sacredness and purity, our entire consciousness starts blossoming. That is why all the twelve Jyotirlingas were never kept in one place or one state. Some were in the north, some in the south, some in the west – they were distributed all over.
And in those days, all those places were very difficult places to travel to. It used to be so difficult to reach there. One had to go through dense forests, dangerous valleys, city ruins; or on the top of high snow capped mountains, etc., to reach the shrines. For example, Kedarnath shrine is situated deep in the Himalayan range.
In this way, by establishing Lord Shiva through His sacred shrines in different parts of the country, the holy sages and saints of those days built a unified nation.
So many saints have visited these holy places, meditated there and have done Tapasya(penances), and that is how the sanctity and glory of these places has grown over time.