Can a pregnant woman take melatonin supplament to help with sleep?

Yes. Melatonin is a hormone that is produced naturally by the pineal gland in the back of the brain. It is produced when night falls and is related to circadian (about 24 hours) rhythm. If you are not producing the natural melatonin, the pills are not as good.