Is it ok to play ball with basketball with a back problem?

Exercise is . Generally good for your back for most common back issues but if certain positions or activities significantly aggravate the symptoms you may need to seek treatment if they do not improve with time.
Maybe. Many types of back problems respond well to regular exercise. Back problems in general, however, are so broad in scope and varied in treatments that it would be imperative to see a spine specialist to seek advice on the specific type of ailment you are describing. Only after a full history and physical and occasionally imaging can this safely be determined.