I have heard that there were some people who changed sides from the Pandavas' army to the Kauravas' army and vice versa during or just before the battle. Can anyone please name all such people and also the reason for the change?
I can think of three people who switched sides right before the war:
Yuyutsu: He was the son of Dhritarashtra and a Vaishya woman. As I discuss in this answer about the birth of the Kauravas, Gandhari was pregnant with the hundred Kauravas for two years. Dhritarashtra was worried that Gandhari would never give birth, so as a precaution he decided to have a son with a Vaishya women, as described in this chapter of the Adi Parva of the Mahabharata.
In any case, Yuyutsu felt that his brother Duryodhana's actions were wrong, and that the Pandava side was righteous. So in the beginning of the battle, when Yudhishthira proclaimed that anyone who wanted to could join the Pandava side, Yuyutsu decided to join, as described in the Bhishma Parva of the Mahabharata:
Then amid all the warriors the eldest son of Pandu, loudly exclaimed,--He who will choose us, him we shall choose for our ally!--Casting his eyes then upon them, Yuyutsu said these words, with a cheerful heart, unto Kunti's son king Yudhishthira the Just,--I will fight under thee in battle, for the sake of you all, with the sons of Dhritarashtra, if, O king, thou wilt accept me, sinless one.' Yudhishthira said, 'Come, come, all of us will fight with thy foolish brothers. O Yuyutsu, both Vasudeva and we all say to thee--I accept thee, O thou of mighty arms, fight for my cause. On thee rests, it seems, the thread of Dhritarashtra's line as also his funeral cake. O prince, O thou of great splendour, accept us that accept thee. The wrathful Duryodhana of wicked understanding will cease to live.' ... Yuvutsu then, abandoning the Kurus thy sons, went over to the army of the Pandavas, with beat of drums and cymbals.
Note that Yuyutsu survived the war, and when the Pandavas gave the throne of Hastinapura to Arjuna's grandson Parikshit, Yuyutsu served as one of Parikshit's two regents, governing the kingdom in Parikshit's name since Parikshit was too young. (The other regent was Parikshit's grandmother Subhadra, wife of Arjuna and sister of Krishna.)
Satyaki:. He was a valiant Yadava warrior and relative of Krishna. As described in this chapter of the Udyoga Parva of the Mahabharata, Duryodhana and Arjuna both approached Krishna and asked for the help of him and his army in the upcoming war. Krishna gave them each a choice as to whether they wanted him or the Yadava army. Arjuna chose Krishna, and Duryodhana got the help of the Yadava army. So that meant Satyaki was pledged to the Kaurava side, but he still chose to fight for the Pandavas, because he was so passionate about their cause, as described in a later chapter of the Udyoga Parva of the Mahabharata:
Satyaki said, 'The high-souled Sahadeva, O thou of mighty arms, hath spoken the truth. The rage I feel towards Duryodhana can be appeased only by his death. Dost thou not remember the rage thou too hadst felt upon beholding in the woods the distressed Pandavas clad in rags and deer-skins? Therefore, O foremost of men, all the warriors assembled here unanimously subscribe to what the heroic son of Madri, fierce in battle, hath said!'
Satyaki survived the war, but was ultimately killed when the Yadavas killed each other, which I describe in this answer.
Shalya: He was the king of Madra and brother of Pandu's wife Madri, so naturally he wanted to fight on the Pandava side. But when Shalya and his army came, they were greeted by Duryodhana's men, who provided them with food, lodging, and entertainment. Shalya assumed that Yudhisthira was responsible for all this, so he wanted to reward him for the hospitality. But then he found out that Duryodhana was the one responsible, so he was forced out of a sense of honor to reward Duryodhana, as described in this chapter of the Udyoga Parva of the Mahabharata:
And when Salya was exceedingly pleased and ready to grant even his life, Duryodhana, who had remained concealed, came forward and showed himself to his maternal uncle. And the kind of the Madras saw him and understood that it was Duryodhana who had taken all the trouble to receive him. And Salya embraced Duryodhana and said, 'Accept something that you may desire.' Duryodhana thereupon said, 'O thou auspicious one, let thy word be true, grant me a boon. I ask thee to be the leader of all my army.'
So Shalya was tricked into fighting on the Kaurava side, despite his love for the Pandavas. In the course of the war, he killed Abhimanyu's brother-in-law Uttara (as I discuss in this answer), served as charioteer of Karna, and finally became the general of the Kaurava side after Karna died. Ultimately Yudishthira was forced to kill Shalya, which must have been an agonizing decision.
It's important to note that even while fighting for the Kaurava side, Shalya still supported the Pandavas, and while driving Karna's chariot he tried to demoralize Karna as much as possible. Shalya was fundamentally a good person put into a terrible situation, forced to fight his own nephews even though he knew their cause was just.