Yes an elephant can be kept as a pet as long as you can properly take care of it and have room for it.
Elephants are not considered to be an endangered species so you can have an elephant as a pet as long as you're zoning laws allow it.
Elephants are very big and need a lot of room to roam around so you need acres of land to keep an elephant.
If you do have a large farm and have room to have an elephant you certainly can keep one.
You also need to make sure you have enough money to be able to feed the elephant as it can be very costly to keep and feed and care for an elephant.
You may be paying $1,000.00 per month or more in food for the elephant along with medical and vet care.