It is not safe unless you are certain it was caught and prepared properly.
Risks
Crabs can accumulate toxins like ciguatera, harbor parasites, and carry bacteria such as Salmonella if undercooked.
Safe Practices
Buy from reputable seafood markets, cook thoroughly until the meat is opaque and flaky, and avoid wild crabs from polluted areas.
When in doubt, do not eat it.