How to sort (orderby) a query done by a template function before the ‘foreach’ loop?

Without knowing what Realia_Post_Type_Property::get_properties() does and returns, this is a bit tricky to answer. But essentially, you want to to sort an array using PHP.

Unless Realia_Post_Type_Property::get_properties() allows you to get a sorted list of posts, your best bet is probably to use wp_list_sort().

That function sorts a list of objects, based on one or more orderby arguments. Assuming $subproperties is an array of WP_Post objects, you should be able to do the following:

$subproperties = wp_list_sort( $subproperties, array( 'post_title' => 'DESC' ) );