Amy inseminated herself with semen from the fertility clinic.
Earlier in Gone Girl, Nick mentions that he went to the fertility clinic and left a sample of his semen. He talks about the early '90s porn, the vinyl-covered armchair, and the television in the room. He went three times before they decided not to have a child because Amy thought she'd have to do all the work while Nick got to be the fun dad.
At the end of the book, Amy reveals that she's pregnant with Nick's child. He doesn't understand how it's possible, until he remembers the will-destroy notice that the clinic sent telling him they were going to get rid of his semen. Amy got it instead. She used it to inseminate herself and conceive Nick's child so that he'd stay with her.