Joint aspiration is performed to diagnose the cause of joint swelling, pain, or stiffness by analyzing the fluid. It can also be used to relieve pressure and pain caused by excess fluid in the joint, often due to conditions like arthritis or infections.