If you're on pelvic rest (as the others have said), then it's not OK because it will give you contractions. But if everything is fine, then go ahead. It's as safe as having sex, or even safer.
Me and my boyfriend use one all the time during four play and sex and I'm 18 wks 5 dys, I agree with sehale as long as ur Dr said u couldn't have sex go right ahead unless something feels or seems wrong, ur body will tell u if something is wrong.
As long as your doctor hasn't told you no sex at all, it's safe.