In COBOL, to use a variable from a main program in a subprogram, it must be defined as GLOBAL in the main program to make it accessible across programs. Additionally, it should be included in the linkage section of the subprogram to establish the communication between programs. Both requirements are necessary for proper data sharing.