If it is student debt or a mortgage, then no problem. But if it is credit card debt, it makes no sense. Credit card debt interest is often 18%. Markets have historically given 10–10.5%. The maths tells you to get rid of the debt first.
Moreover, it often makes sense to have 2–3 months liquid savings in the bank before investing, just in case of an emergency.
So I would say, the answer is no 90% of the time. Invest with surplus cash not borrowed cash.
RE: Musing Posts 2