The easiest solution, assuming your TeX distribution is reasonably up to date, consists of loading the xurl package; it allows arbritary line breaks in URL strings. Should your TeX distribution lack the xurl package, I suggest you (a) load the url package with the options spaces and hyphens and (b) switch to \raggedright right before \bibliography{ref}.
Whatever else you do, please encase the author field in an extra pair of curly braces. Doing so informs BibTeX that it's dealing with a "corporate" author and not with a person whose first name is "Statistics" and whose surname is "Mauritius". And do get rid of the \text wrapper too, as it is not appropriate here.

\RequirePackage{filecontents}
\begin{filecontents}{ref.bib}
@article{stats2017,
title = "{Digest of Education Statistics 2017}",
author = "{Statistics Mauritius}",
year = 2017,
url = "http://statsmauritius.govmu.org/English/Publications/Pages/Edu_Stats_Yr2017.aspx",
}
\end{filecontents}
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[numbers,round]{natbib}
\bibliographystyle{agsm}
\renewcommand\harvardurl[1]{\textbf{URL}: \url{#1}} % optional
\usepackage{xurl} % allow line breaks anywhere in URL string
\begin{document}
\cite{stats2017}
\bibliography{ref} % not "\bibliography{ref.bib}"
\end{document}
\bibliographystyle) your are using, so in order to help, you we would need to know about it. Please consider adding a complete example document (https://tex.meta.stackexchange.com/q/228/35864, https://tex.meta.stackexchange.com/q/4407/35864) to tell us what you are doing. But URL breaking is a bit tricky and it certainly looks as though this URL is hard to fit into the available space if you only allow the standard break points. – moewe Mar 31 '19 at 12:13authorshould be given asauthor={{Statistics Mauritius}},, there is no need for\text, but you do want to pairs of curly braces (https://tex.stackexchange.com/q/10808/35864). Usually you don't have to include the\url{...}macro in theurlfield, sourl={http://statsmauritius.govmu.org/English/Publications/Pages/Edu_Stats_Yr2017.aspx},should be enough. It could be that your style/bibliography package does not apply\urlby default, but that can be changed (https://tex.stackexchange.com/q/9445/35864) – moewe Mar 31 '19 at 12:16\raggedrightor another breakpoint is defined, the extra space isn't going to go away. – barbara beeton Mar 31 '19 at 13:50