Short answer; it depends how old the piano is!
During the early days of the piano's development in the 18th century, all piano keys were made from Ivory, which was valued for its durability and ability to produce a clear, bright sound. Piano makers would handpick the best ivory from elephant tusks to create keys for their pianos.
As the popularity of the piano grew in the 19th century, the demand for ivory increased dramatically, leading to an alarming decrease in elephant populations. by the 20th century, international efforts were made to protect endangered species, and the use of ivory for piano keys became controversial.
Nowadays, ivory is illegal to trade in many countries, which has prompted a search for alternative materials to create piano keys. Today, modern piano makers create keys using materials like Ivorine, a synthetic substance that mimics the look and feel of ivory, whilst being a more a long-lasting and durable material. It is difficult to distinguish from the real thing, and some argue produces a much better sound (I'm one of those!), This technological development allows piano makers to produce high-quality pianos without contributing to the harm of endangered species, which is great news for animal lovers and piano enthusiasts alike.
So can you still buy pianos with ivory keys? Well surprisingly, yes!
Whilst the use of ivory for piano keys is illegal in most countries, for example in the United States, where it has been prohibited since 1976 under the Endangered Species Act, some vintage pianos still exist with ivory keys, and they can be legally owned and sold if they were made before the ban on ivory trade was implemented. Given the fact that pianos can easy last over 150+ years when properly cared for, this means that ivory-keyed pianos will still likely be in circulation for many generations to come.
That said, if you'd like the Stephen Ridley opinion on ivory keys, I really don't rate them. If you look at early videos of me playing piano in the streets (I started my musical career playing piano in the streets), you'll see I have tape all over my hands. This is because I was playing on old upright pianos, 100+ years old, which had ivory keys. Over time, the keys splinter and crack, and those cracks are INCREDIBLY sharp. It would literally slice my fingers open on fast songs and runs. The key edges can be like feathered razor blades. I seriously don't recommend it!