Generally spoken, yes, you can sponsor a spouse even if you have a loan, but there are some more restrictions that may apply. For example, if a spouse or partner sponsored you, you now cannot sponsor a new spouse or partner within five years of becoming a permanent resident.
It’s difficult to give you a definite answer without knowing more about your background. The loan will not keep you from sponsoring your wife, but other factors might.