Depends on what your intentions are,if your sick in the Hospital
or sick anywhere then its ok.Or if your having a baby or something
like that .
But if your looking for lust attentions from opposite sex or
nowadays same sex then it's sin unless your married and with your
partner.
God is the originator of all sins.