All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
There are two different situations and each one of them has a specific ruling.
First, the Muslim, who lives in a country where the sun rises and sets but the length of daylight may vary in summer and winter, has to divide the day in a way that allows him to pray the five prayers at their prescribed fixed times regardless of the length of daylight hours.
Allah Says (what means):
• {Establish prayer at the decline of the sun [from its meridian] until the darkness of the night and [also] the Qur'an of dawn. Indeed, the recitation of dawn is ever witnessed.} [Quran 17:78]
• {And when you have completed the prayer, remember Allah standing, sitting, or [lying] on your sides. But when you become secure, re-establish [regular] prayer. Indeed, prayer has been decreed upon the believers a decree of specified times. } [Quran 4:103 ]
Buraydah reported on the authority of his father that a man came to the Prophet and asked him about the times of the prayer. Upon this the Prophet said: "Pray with us these two, meaning two days. When the sun passed the meridian, the Prophet gave command to Bilal to proclaim the Athaan to prayer, then he commanded him to pronounce the Iqama for Thuhr prayer. At the time of the ‘Asr prayer, he again commanded him to call the Athaan and Iqama for the ‘Asr prayer when the sun was high, white and clear. He then commanded him to call the Athaan and then the Iqama for the Maghrib prayer when the sun had set. He then commanded him to call the Athaan, and then the Iqama for ‘Isha prayer when the twilight had disappeared. He then commanded him to call the Athaan, and then the Iqama for the Fajr prayer, when Fajr (dawn) had appeared. When it was the next day, he commanded him to delay the Thuhr prayer till the extreme heat had passed and he did so, and he allowed it to be delayed till the extreme heat has passed. He observed the ‘Asr prayer when the sun was high, delaying it beyond the time he had previously observed it. He observed the Maghrib prayer before the twilight had vanished, he observed the ‘Isha prayer when a third of the night had passed; and he observed the Fajr prayer when there was clear daylight. The Prophet said: “Where is the man who inquired about the time of the prayer?” The inquirer said: “Messenger of Allah! Here I am. The Prophet said: “The time of your prayer is within the limits of what you have seen.” [Al-Bukhaari and Muslim] There are more Ahadeeth specifying the times of prayers.
As for specifying times of fasting in such countries, Muslims should fast from Fajr to sunset (i.e. Maghrib) regardless of how long or short daylight hours may be. Similarly, they should not fast after sunset.
Allah Says (what means): {And eat and drink until the white thread of dawn becomes distinct to you from the black thread [of night]. Then complete the fast until the sunset.} [Quran 2:187]
But, whoever breaks his fast due to the length of the day, or fear of becoming very sick, or fear of worsening an existing illness, or delaying its cure, can make up for the missed days whenever he is able.
Allah Says (what means):
• {So whoever sights [the new moon of] the month, let him fast it; and whoever is ill or on a journey - then an equal number of other days.} [Quran 2:185]
• {Allah does not charge a soul except [with that within] its capacity.} [Quran 2:286]
• {…and has not placed upon you in the religion any difficulty.} [Quran 22:78]
The second situation is where the person resides in a country where the sun does not set during summer and does not rise during winter, and this situation might go on for six months. Such Muslims should pray the five prayers in each 24-hour period. In this case, they fix approximate times for the times of prayers basing their estimation on the closest place where the time for night and day are distinct, and then specify the different times for each prayer.
Al-Bukhaari, Muslim, and others reported on the authority of Talhah ibn ‘Ubaydullah who said: “A man from Najd with disheveled hair came to the Messenger of Allah . We heard his loud voice but we did not understand what he was saying, until he came near. He was asking about Islam, so the Messenger of Allah said: “Five obligatory prayers in a day and night.” The man asked, “Are there any other prayers due upon me?” The Prophet said: “No, unless you wish to perform voluntary prayers.”
Again when the Prophet talked to the companions about Dajjaal (Antichrist), they asked him about how long the Antichrist would stay on Earth. The Prophet said, “The Antichrist will stay for forty days; one of these days will be as long as a year; another day will be like a month; another like a week, and all the remaining days will be similar to the days people know. One of the companions asked the Prophet saying: “The day that is equal to a year will it be sufficient for us to pray only the five prayers we pray in normal days?” The Prophet answered: “No! Estimate for that.” [Muslim]
So, the Prophet did not consider the day that is equal to a year a normal day in which a Muslim is asked only to pray five prayers.
Hence, as we mentioned earlier, Muslims who live in countries where the sun does not set for a long time or does not rise for a long time should fix the times of prayers and fasting according to the area closest to them where the day and the night are distinct.
Then begin fasting according to that area and end fasting according to it on monthly and daily basis. Then estimate days on a 24-hour-basis.
Allah knows best.