You don't mention where you live; my answer is based on experience in the US. You also don't say whether your advisor is moving to a different department, moving to a different university, leaving academia for industry, or simply retiring; my answer assumes they're moving to a different university.
You and your supervisor should have been talking about this from the moment they decided to leave (if not sooner). If you haven't been, START NOW! By agreeing to advise you, they accepted an ethical responsibility to guide you to the completion of your degree to the best of their ability. That obligation survives their departure and extends to their new employer. Similarly, by admitting you into the PhD program, your current department accepted an obligation to help you complete your degree, despite your advisor's departure. Everyone involved is supposed to have your back.
When faculty move from one university to another, they rarely move only the books in their office; they more typically move a large fraction of the system that supports their research. That can include funding, equipment, postdocs, and yes, PhD students. It's quite common for students to keep their advisors even after they move. I've seen this happen a few different ways:
The student enrolls in the PhD program in advisor's new department and moves to the new department. This can happen "off-cycle", bypassing the normal admissions calendar if the advisor negotiates for that. If the new PhD program has course requirements, the student may be able to transfer some or all of the courses taken at their original department, especially if the advisor negotiates for that.
The student moves to the advisor's department, but remains formally enrolled in their original PhD program. This may require the advisor to negotiate with both departments, to retain advising rights and grants in the old department, and to get access to office space and equipment for a non-student in the new department. This may also require the advisor and student to physically travel to the old department for formalities like the defense.
The student formally enrolls in the advisor's new department, but remains physically at the old department. (Some students have family or other geographic constraints.)
The student stays in the original department, both physically and formally, and is advised remotely by their advisor via email, phone calls, video chats, and sporadic physical visits. This is really advisable only for students late in the PhD program, who can work more independently. If the advisor retains advising rights in the old department, they can remain the advisor or record; otherwise, the student needs to find a local co-advisor to sign the paperwork. The advisor would likely need to retain some funding at the old institution.
The student transitions to a new (co-)advisor at the old department, with the old advisor's help. This may require your current advisor to delay their departure for a semester or two while the transition is underway.
There are similar options for faculty who are retiring, and possibly (depending on their new job) even faculty moving to industry.
All of these options require your current advisor to negotiate on your behalf. This is why it is absolutely vital to discuss your options with your advisor as soon as possible.