When returning from one Activity to another it is to restart the activity so the fragmentManager does not have any fragment.
For this, from the second activity, it is necessary to pass to the intent some identifier (a name or a number) and then from the onCreate
of the activity invoke the fragment that you want to show:
Intent intentMain = new Intent(SecondActivity.this, MainActivity.class);
intentMain.putExtras("previousFragment", 2);
startActivity(intentMain);
And from the onCreate
of MainActivity:
int previousFragment = getIntent().getExtras("previousFragment");
if(previousFragment == 2) {
// llamar al fragment
SegundoFragment fragment = SegundoFragment.newInstance();
FragmentManager ft = getSupportFragmentManager();
ft.beginTransaction().replace(R.id.fragment_container,
fragment).commit();
}