Are there any medications that won't harm the baby but allow a pregnant mother to sleep?

Yes. Benadryl or tylenol (acetaminophen) pm are both safe to take and are available over the counter. Avoiding day time napping and exercising everyday helps too.
Sleep Hygene . Is the safest approach , other medication can be benadryl (diphenhydramine). But if u take it on daily basis it can stop working.