We numerically test an experimentally realizable method for the extraction of the critical Casimir force based on its thermodynamic definition as the derivative of the excess free energy with respect to system size. Free energy differences are estimated for different system sizes by integrating the order parameter along an isotherm. The method could be developed for experiments on magnetic systems and could give access to the critical Casimir force for any universality class. By choosing an applied field that opposes magnetic ordering at the boundaries, the Casimir force is found to increase by an order of magnitude over zero-field results.