Ge 47:28 And Jacob lived in the land of Egypt seventeen years. So the length of Jacob's life was one hundred and forty-seven years.
29 When the time drew near that Israel must die, he called his son Joseph and said to him, "Now if I have found favor in your sight, please put your hand under my thigh, and deal kindly and truly with me. Please do not bury me in Egypt,
30 "but let me lie with my fathers; you shall carry me out of Egypt and bury me in their burial place." And he said, "I will do as you have said."
31 Then he said, "Swear to me." And he swore to him. So Israel bowed himself on the head of the bed.
God promised Jacob that He would return Jacob back to the promise land.
Ge 46:3 So He said, "I am God, the God of your father; do not fear to go down to Egypt, for I will make of you a great nation there.
4 "I will go down with you to Egypt, and I will also surely bring you up again; and Joseph will put his hand on your eyes."
Here, Jacob is manifesting his faith in the promises of God. He believed in God that his future inheritance is not the land of Egypt but the land promised to him and his fathers by God, the Promised Land of Canaan. He made sure by making Joseph promise that he would be buried in Canaan not in Egypt. And so, in the custom of the day in making a promise, Jacob made Joseph place his hand under his thigh.
Moses is encouraging his original Israelites readers that their future inheritance is not Egypt but Canaan.