In calculating bmi, how does one compensate for weight loss due to osteoporosis?

No bearing. The BMI is reflective of only your weight and height, regardless of how your weight got to what it is right now. No compensation for osteoporosis.
BMi. You probably mean height loss. Would use the height you had prior to any loss. Though not perfectly accurate it will give you a very reasonable result.