How do you take Metformin?

Annie • 23 years old. Diagnosed with PCOS & hypothyroidism. Married for 5 years. Ellie Rose 💕👶🏼 & Millie Jean 💕🤰🏼
My doctor said I could go from 500mg --> 1000mg and to take 2 pills a day. I had weird, painful stomach problems I hadn't ever had before. Do I take it with food even though I'm taking it for PCOS? Do I take them at different times of the day?