What can cause your pointer finget our thumb to lock in place straight until u move it with other hand wen it losens up. It hurts until it releases?

Early swan neck. This could be due to laxity in the joints and/or the ligaments/tendons/bands resulting in an early swan neck deformity.
Trigger Finger. This is most likely a trigger finger which is a form of tendinitis of the tendons that bend down the finger. It can cause pain and catching of the finger as well as locking. Most effective treatment is an injection of cortisone to reduce the inflammation. I would see a hand surgeon for an evaluation.
Trigger finger. Finger tendons can be inflammed causing such symptoms. Anti-inflammatories and physical therapy aimed at range of motion exercises can help. Steroid injections can help too. If severe, may need to see a hand surgeon for surgery.