Final answer:
You can change a custom field from lookup to master-detail in Salesforce after ensuring that all detail records have a related master record and no sharing rules depend on the lookup field.
Step-by-step explanation:
Yes, you can change a custom field's definition from lookup to master-detail in Salesforce, but there are certain limitations and considerations. Initially, a lookup relationship is a loose coupling between objects that does not enforce record deletion or security. In contrast, a master-detail relationship is a tight coupling which does enforce those rules.
To convert from lookup to master-detail you must first make sure that every detail record (child) has a related master (parent) record. Additionally, there should be no sharing rules dependent on the lookup field. After these requirements are met, a field type change can be made through the object's field settings in Salesforce setup.
However, if you want to convert a master-detail relationship to lookup relationship, you must first convert the master-detail to a lookup in a two-step process. This is because the master-detail relationship is more restrictive and you would first need to relax those rules.