Emma Roberts' pregnancy journey didn't go exactly as planned.

The 29-year-old actress said that after being diagnosed with endometriosis, doctors recommended she freeze her eggs if she ever wanted to have a child.

"At 16, I thought, 'By the time I’m 24, I’ll be married with kids,'" she told Cosmopolitan magazine. "And then I was 24 and I was like, 'Remember when I said I would be married with kids by now?'"

Now the actress is expecting her first child -- a boy -- with boyfriend and fellow actor Garrett Hedlund. "It sounds cheesy, but the moment that I stopped thinking about it, we got pregnant," she revealed.

EMMA ROBERTS' MOST MEMORABLE TV AND MOVIE ROLES

Roberts added that freezing her eggs was "a difficult process" and she sometimes felt alone throughout the process. 

"When I found out about my fertility, I was kind of stunned," she admitted. "It felt so permanent, and oddly, I felt like I had done something wrong."

Emma Roberts is expecting a son with boyfriend Garrett Hedlund. 

Emma Roberts is expecting a son with boyfriend Garrett Hedlund.  (Getty)

Luckily after speaking with different women about "endometriosis, infertility, miscarriages, [and] fear of having kids," she was able to soothe some of her anxiety.

EMMA ROBERTS REVEALS SHE BLOCKED HER MOM ON INSTAGRAM FOR ACCIDENTALLY ANNOUNCING HER PREGNANCY

Although she was having a healthy pregnancy, Roberts still didn't want to share the news publicly until she was ready.

"So I kept it to myself, my family, and my partner, not wanting to make grand plans if it wasn’t going to work out," she reasoned. "This pregnancy made me realize that the only plan you can have is that there is no plan."

Garrett Hedlund (L) and Emma Roberts (R) began dating in 2019.

Garrett Hedlund (L) and Emma Roberts (R) began dating in 2019. (BG015/Bauer-Griffin/GC Images)

Roberts added that she's adjusting to her changing body day-by-day. "To see my body change inside and out so drastically has been a wild experience. Surprising and beautiful," she said. "Then again, some days I feel like I’m being hijacked by something."

CLICK HERE TO GET THE FOX NEWS APP

Roberts and Hedlund start dating in 2019.