Yes, although anything further than 'stress relief' (relationship-wise) was frowned upon.
An example of someone having (implied) physical relations with a holodeck character is in the Voyager Episode: Human Error. Seven of Nine, who (in the pursuit of honing her social skills) dates, kisses and then wakes up next to a Holographic version of Chakotay. Whilst we don't see anything, it is strongly implied that they have relations.
The following is a quote from The Voyager Transcripts. Information surrounding the scene has been added in.
SEVEN: Remain still. You have an intriguing facial structure.
HOLO-CHAKOTAY: I'll take that as a compliment. (they kiss)
SEVEN: I require more practice.
HOLO-CHAKOTAY: You're doing just fine. (Seven hears an electric zizzing sound) What's wrong?
[Cut to Seven's dream]
[Cut to Holodeck - Seven's Virtual quarters]
(Seven wakes up with the holographic Chakotay draped over her on the couch. The real Chakotay is hailing her over the com-system)
CHAKOTAY [OC]: Chakotay to Seven of Nine. Chakotay to Seven, respond.
SEVEN: Go ahead.
CHAKOTAY [OC]: Report to Astrometrics. We've found something.
SEVEN: Yes, Commander.
HOLO-CHAKOTAY: Good morning.
Another example would be the Vulcans on-board Voyager, having to deal with Pon-far. Both Tuvok and another Vulcan are shown trying to deal with the symptoms using the holodeck. It works for Tuvok, but not for the other Vulcan.
Potential Psychological problems/ Unhealthy attachments to holographic characters:
In Star Trek: Voyager, Reginald Barklay (Main contact character of Earth to Voyager) struggled with "Holodeck Addiction" in his past (and suffers a bit of a relapse at one point).
It is a prescribed mental illness, complete with the whole she-bang: drugs, counselling, removal from sources of stress, de-tox etc.
Whilst in Reg's case it wasn't a relationship in a sexual way to any of the characters, he had re-created virtual embodiments of the entire Voyager crew, and he mentioned that he didn't get a good night's sleep unless he slept in his (virtual) quarters on Voyager.
Some examples are:
- The Doctor woos a virtual partner (in a 60's style car on an overlook, no less). Albeit the virtual partner was just a holographic representation of a living being at the time, so she could be considered 'real' but the doctor isn't- although I don't think anyone would object to him finding a virtual mate.
- Harry Kim believes he's fallen for a virtual character (it turns out to be a hoax). But Tom Paris warns him about holodeck addiction before they figure that out.
Needless to say the holodeck programs are definitely used for this sort of thing - I can see them replacing (or supplementing) real... ahem, 'Ladies of the Night' in a non-military setting. But anything further than 'stress relief' would be frowned upon, and in extreme cases treated as an illness.