Six years ago I had an abortion. I'am 24 years old that time. Is there possibility to detect or the doctor will know about it? Thank you!

Unlikely. It is unlikely to detect a previous abortion unless instrumentation was used and even then it is still unlikely. You may want to consider telling your doctor, however. There is patient-doctor confidentiality which prevents them from sharing your information without your permission. Plus, information kept from your doctor can only hinder your care.
No. That can remain private if that is what you choose. The doctor will not know by an exam.