It is probably a temporary displacement of the kneecap or a strained ligament. It happens at this stage of pregnancy
when the joints are moved in an awkward position as the joints are usually lax. You may need a knee cap for support and local analgesics for pain and swelling relief. Rest the joint as much as possible and you should be fine in few days. Take further advice from your doctor. Good luck.