It is a term that has its primary use in government, especially military or espionage. It means that the information has security concerns and it must be given to only those that "need to know it" in order to perform their assigned jobs. People use it in everyday conversation to mean information that is personal or otherwise sensitive that I do not want you to know.
"The total scope of the army's invasion plan is on a need to know basis."
"The computer code for italki.com is on a need to know basis."
"What my wife and I discussed last night is on a need to know basis."