Can stomach keyhole surgery to remove a cyst cause sex to become painful?

Possibly. Pain that severe needs to be worked up by your doctor in person. He/she will listen to you, perform an examination and possibly order some tests to see what's wrong with you.