The shofar should be sounded during the day only, and not at night. The mitzvah can be fulfilled from sunrise until sunset; those who are diligent fulfill the mitzvah at the first possible opportunity.
Why then did it become a tradition to sound the shofar publicly after the Torah reading and during Musaf rather than during the earlier Shacharit service? This custom was established because of an incident that once occurred during a period of persecution by our enemies. They suspected our people of plotting to wage war against them, and decided that the gatherings in the synagogues and the sounding of the shofar were a call to arms, and saw this as grounds to kill the Jews. The practice was consequently adopted of sounding the shofar later, for the sight of the Jews reciting the Shema, praying the Shacharit service, reading from the Torah, and only then sounding the shofar, provided convincing proof that the Jews were engaged solely in fulfilling mitzvos and not in a call to war.
Another reason for the postponement of the sounding of the shofar until Musaf is as follows: An edict was once issued forbidding the Jews to sound the shofar and spies were posted near the synagogues to ensure that they did not do so. When the spies saw that midday had come and the shofar had not been sounded, they left and the shofar was then sounded. Although the reason for the custom is no longer relevant, it was decided not to revert to the original custom of sounding the shofar during Shacharit, in fear that a similar decree might once again be promulgated.