Hi,
Pyramids were built for religious purposes. The Egyptians were one of the first civilizations to believe in an afterlife. They believed that a second self called the ka lived within every human being. When the physical body expired, the ka enjoyed eternal life.
Hope this helps