Assalamualaikum w.b.t. What is the ruling if a man or woman shaves his/her legs? Hope for an explanation.
Alhamdulillah, praise and gratitude to Allah SWT for His countless blessings for us all. Praise and salutations to our beloved Prophet Muhammad PBUH, his family, companions and all those who follow his footsteps until the Last Day.
The act of shaving means cutting or removing the hair right up to the base or root of the hair using a shaver or similar tools. 
Regarding the issue of shaving or cutting human body hair, scholars categorized its ruling into three parts as the following:
First: Body hair that is commanded to be shaved
In syarak evidences, there are several commandments to shave several types of human body hair. This is as stated by Rasullullah PBUH:
الْفِطْرَةُ خَمْسٌ ـ أَوْ خَمْسٌ مِنَ الْفِطْرَةِ ـ الْخِتَانُ، وَالاِسْتِحْدَادُ، وَنَتْفُ الإِبْطِ، وَتَقْلِيمُ الأَظْفَارِ، وَقَصُّ الشَّارِبِ
“Five practices are characteristics of the Fitra: circumcision, shaving the pubic region, cutting armpits hair, clipping the nails and cutting the moustaches short.” 
Scholars commented on the word Istihdad in the above hadith saying it means: Shaving the pubic region. Imam al-Nawawi Rahimahullah said: Istihdad is shaving the pubic region, which includes the hair that grows in the surrounding area. 
Imam al-Nafrawi one of the jurists of madhhab Maliki said that the hairs around the anus are also included in the hair in the pubic region. 
According to the above hadith, there are three hairs mentioned to be shaved and they are the pubic hair, armpit hair, and moustache. Hence, we are commanded to cut, shave or pluck them.
Second: Body hair that is prohibited from being shaved
Several types of body hair are prohibited by syarak to be shaved. Among them is cutting or shaving a beard for men. The restriction for this can be seen in a narration from Abdullah Ibn Umar R.Anhuma where the Prophet PBUH said:
أَحْفُوا الشَّوَارِبَ وَأَعْفُوا اللِّحَى
“Cut the moustache down and leave the beard.” 
The same is stated in a narration that is also narrated from Ibn Umar R.anhuma where Rasullullah PBUH said:
خَالِفُوا الْمُشْرِكِينَ، وَفِّرُوا اللِّحَى، وَأَحْفُوا الشَّوَارِبَ
“Do the opposite of what the polytheists do; let the beard grow long and clip the moustache.” 
Al-Hafiz Ibn Hajar al-Asqalani when commenting on this hadith said: The commandment of the Prophet PBUH relating to the beard means that let it grow and let it be until it grows a lot. 
The commandment of the Prophet PBUH to let the beards be also meant at the same time that the Prophet PBUH restricts from shaving the beard. This is based on the Islamic legal maxim mentioned by Imam Al-Haramain Abdul Malik Al-Juwaini Rahimahullah: The commandment of performing something is also the restriction of doing the contrary. While the restriction of doing something is the commandment of leaving it.
Furthermore, among the types of body hair that are prohibited from being shaved is one’s eyebrows. This is in accordance with a narration from Rasullullah PBUH where he said:
لَعَنَ اللَّهُ الْوَاشِمَاتِ وَالْمُسْتَوْشِمَاتِ وَالنَّامِصَاتِ وَالْمُتَنَمِّصَاتِ وَالْمُتَفَلِّجَاتِ لِلْحُسْنِ الْمُغَيِّرَاتِ خَلْقَ اللَّهِ
“Allah has cursed those women who practise tattooing and those women who have themselves tattooed, and those women who get their hair removed from their eyebrows and faces (except the beard and the moustache), and those who make artificial spaces between their teeth for beauty, whereby they change Allah’s creation.” 
Imam al-Nawawi when commenting on this hadith said: النامصة means women who shaved hairs from their faces. While المتنمصة are women who asked for the hair to be shaved. This act is prohibited except when a woman has facial hair such as a beard and moustache, then it is not haram to shave them.
Al-Hafiz Ibn Hajar commented on the issue of a woman who shaved her beard and moustache saying: It depends on the permission and knowledge from her husband.
Imam al-Nawawi further said: Our madhhab states what we have said regarding the permissibility of shaving beard, moustache and العَنْفَقَةُ (anfaqah) which are minute hairs that grow between the lower lips and the chin (for women). Indeed, the restriction in the hadith for the eyebrows and hairs that may grow on a woman’s face. 
Al-Hafiz Ibn Hajar al-Asqalani when commenting on this hadith stated: Al-Nammash means removing facial hair using a shaver. It is said the act is specific for eyebrows for the purpose of lifting the shape of both eyebrows or balancing both of them.
Ibn Hajar also cited the words of Abu Daud in Al-Sunan who said: النامصة means women who thinned their eyebrows. He also further cited the statement of Al-Thabari as follows: It is impermissible for a woman to change even a little bit from the original creation on herself by Allah SWT by adding or removing any of them for beauty. It is impermissible for her to do so for her husband or others, even for a person who has a unibrow and she shaves the brows in the centre. 
Third: Hairs that are silenced by Syarak
This means that there are no evidences in syarak regardless of whether from al-Quran or sunnah of the Prophet PBUH that instructed for these hairs to be shaved or prohibition for these hairs to be kept. This is based on a hadith from Salman al-Farisi RA where Rasullullah PBUH said:
الْحَلاَلُ مَا أَحَلَّ اللَّهُ فِي كِتَابِهِ وَالْحَرَامُ مَا حَرَّمَ اللَّهُ فِي كِتَابِهِ وَمَا سَكَتَ عَنْهُ فَهُوَ مِمَّا عَفَا عَنْهُ
“The permissible is what Allah has made permissible in His Book and prohibited are matters that Allah has prohibited in His Book. And whatever is not mentioned by Allah (regarding its ruling) are included as forgiven matters.” 
Al-Sindi said when commenting on this hadith: This hadith is in line with another hadith:
إِنَّ اللهَ أَمَرَكُمْ بِأَشْيَاء فَامْتَثِلُوهَا وَنَهَاكُمْ عَنْ أَشْيَاء فَاجْتَنِبُوهَا وَسَكَتَ لَكُمْ عَنْ أَشْيَاء رَحْمَةً مِنْهُ فَلَا تَسْأَلُوا عَنْهَا
“Indeed, Allah commanded you several matters, hence fulfil them and He prohibits you several matters, thus avoid them. And He is silent (regarding the ruling) of several matters due to His rahmah, don’t ask about them.”
All in all, the hadith means: Indeed, the origin (of a ruling) of anything is its permissibility. 
Several examples of such hairs are chest hair, calf hair, thigh hair, hairs on the arms and others of which there isn’t any commandment for them to be shaved or prohibition for them to be kept. Hence, in this matter, a person can either keep the hair without shaving them or shave them if he so wishes.
In our opinion, the original ruling of shaving leg hair for both men and women is permissible. The reason for this is that there is no commandment to shave it nor is there a prohibition to keep it. Although, if cutting or shaving the hair then it can lead to tasyabbuh (resembling) of man to woman, then it is prohibited.
This follows a narration from Abdullah Ibn Abbas R.Anhuma where Rasullullah PBUH said:
لَعَنَ رَسُولُ اللَّهِ صلى الله عليه وسلم الْمُتَشَبِّهِينَ مِنَ الرِّجَالِ بِالنِّسَاءِ، وَالْمُتَشَبِّهَاتِ مِنَ النِّسَاءِ بِالرِّجَالِ
“The Messenger cursed men who resemble women and women who resemble men.” 
Al-Hafiz Ibn Hajar when commenting on this hadith cited the words of Imam Al-Thabari as follows: It is impermissible for a man to resemble a woman in terms of clothing and adornments that are specific for women and vice versa. Al-Hafiz Ibn Hajar said: The same applies (impermissibility of resembling) in terms of speech and way of walking. The curse against tasyabbuh (resembling) in terms of speech and way of walking is specific for those who intentionally do so. As for anyone who is naturally like that, he is commanded to strive to change it. 
However, if according to the uruf (customary) of the locals to not consider a clean-shaven leg of a man as resembling a woman, then there is no issue for him to shave his legs and the original ruling of its permissibility remains.
 Narrated by al-Bukhari (5889)
 SeeTahrir Alfaz al-Tanbih, pg. 253
 Seeal-Fawakih al-Dawani, 2/306
 Narrated by Muslim (259)
 Narrated by al-Bukhari (5892)
 SeeFath al-Bari, 10/350
 Narrated by Muslim (2125)
 SeeFath al-Bari, 10/390
 SeeSyarh al-Nawawi ‘ala Sahih Muslim, 14/285
 SeeFath al-Bari, 10/390
 Narrated by Ibn Majah (3367)
 SeeHasyiah al-Sindi ‘ala Sunan Ibn Majah, 1/326
 Narrated by al-Bukhari (5885)
 SeeFath al-Bari, 10/345